1

I have started a server using Confluence on Centos and have created one page with a table.

Now I want to connect to my page then parse html there and find row&columns but I cannot connect to the page.

My page is located on: http://localhost:8090/display/TEST/Confluence

How can I connect to my page and parse the HTML?

3 Answers 3

1

You can use a confluenca api to get the page ID

from atlassian import Confluence
space = '~MYSPACE'
title_parent = 'PARENT_PAGE_ID'
p_id = confluence.get_page_id(space, title_parent)
print(p_id)

title = 'New page'
body = 'This is the body of a new page'
status = confluence.create_page(space, title, body, parent_id=p_id, type='page', 
                                representation='storage')
print(status)
Sign up to request clarification or add additional context in comments.

Comments

0

Take a look at Atlassian Example here. For updating your page, you need to know your page ID.

Comments

0

It is better to make two request. The first will be a search that will return you the ID of the page, while the latter will return for its contents.

  1. Search
    import requests
    url = confluence_host + '/rest/api/content/'
    res = requests.get(url=url + 'search',
                       params={'cql': 'space="TEST" AND title="Page Titile'})
    page_id = res.json()['results'][0]['id']
  1. Get HTML
    import requests
    url = confluence_host + '/rest/api/content/'
    page = requests.get(url=url + page_id,
                        params={'expand': 'body.storage'}).json()
    html = page['body']['storage']['value']

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.