Hello,
For years, I’ve been accessing the Confluence Cloud using the Python module requests
to automatically read pages. Authentication has always worked as follows:
import requests
session = requests.Session()
session.trust_env = False
headers: dict = {
"Authorization": "Basic Usermail:PasswordAsBase64String"
}
URL = "https://MYCOMPANY.atlassian.net/wiki/rest/masterdetail/1.0/detailssummary/lines?cql=label=produkt_spezifikation&spaceKey=TPOM&pageSize=1000&headings=Multilanguage-Bezeichner"
GETResponse = session.get(URL, headers=headers)
JSONResponse = json.loads(GETResponse.text)
Since I didn’t know what the issue was, I switched to token-based authentication. The call now looks like this, but it results in the same error:
import requests
from requests.auth import HTTPBasicAuth
URL = "https://MYCOMPANY.atlassian.net/wiki/rest/masterdetail/1.0/detailssummary/lines?cql=label=produkt_spezifikation&spaceKey=TPOM&pageSize=1000&headings=Multilanguage-Bezeichner"
GETResponse = session.get(URL, auth=HTTPBasicAuth(confluenceMail, confluenceToken))
JSONResponse = json.loads(GETResponse.text)
When I open the URLs in a browser, the data is displayed correctly. However, Python fails to access the specific URLs. I can still access the homepage of our team space, which is:
https://MYCOMPANY.atlassian.net/wiki/spaces/TPOM/overview/rest/api/content/
But as soon as I try to access the masterdetail pages, I get a 401 error.
What can I do?
Hello @Sebastian Krzewiński ,
thank you for your answer. Yes, I have a new token. It seems like the issue is related to the masterdetail. When I use the Atlassian Python module, I can access the data. Can anyone tell me how to get the master-detail working again? I not really want to modify our whole toolchain if not really necessary
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.