Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

I want to get the Confluence page content through python but SSO is enabled for that. please suggest

Kotesh Nataru March 21, 2023

I want to get the Confluence page content through python but SSO is enabled for that. please suggest. 

I have tried through requests and Confluence package. The request is going to SSO and stopping. how can we skip the sso or any other way  and get the content from confluence page. I am getting struck here. Thanks in advance!

 

Here is the sample code:

Through requests :

import requests

s = requests.session()
url_login = "https://xxxxxxxxx/idp/qtvBS/resumeSAML20/idp/SSO.ping"

payload = {
"username": "xxxxxx",
"password": "xxxxx"
}

req1 = s.post(url_login, data=payload)
cookies = s.cookies.get_dict()

# Now to make sure you do not get the "Access denied", use the same session variable for the request.
req3 = s.get('xxxxxxxxxxxxxxxxxxxxxxxxxxx', verify=False, cookies=cookies)

Through Confluence:

from atlassian import Confluence

confluence = Confluence(
url="xxxxxxxxxxxxxxxxxxxxxxxxxx",
username = "xxxxxxxxxxxxxxxxxxx",
password = "xxxxxxxxxxxxxxxxxxxx",
verify_ssl = False
)
page_html = confluence.get_page_by_id('1234444', "space,body.view,version,container")
print(page_html)

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events