I've tried various ways to get this working, but although I can view the confluence_url in a browser with no issue (so the URL is valid), I'm not able to return the contents of the page in Python v3. Where am I going wrong? any obvious issues? I'm guessing the issue is authentication.
note: I use the same authentication method for Jira and have no issue.
import base64
import requests
personal_access_token = "xxxxxxxx"
organizational_url = "https://confluence.global.xxx.com/"
authorization = str(base64.b64encode(bytes(':'+personal_access_token, 'ascii')),'ascii')
headers = { 'Accept': 'application/json', 'Authorization': 'Bearer '+authorization }
confluence_url = organizational_url+'rest/api/content/123456789?expand=body.storage'
response = requests.get(url=confluence_url, headers=headers, verify=False)
print(response.status_code)
print(response.text)
response.status_code is 404,
response.text is {"statusCode":404,"data":{"authorized":false,"valid":true,"allowedInReadOnlyMode":true,"errors":[],"successful":false},"message":"No content found with id: ContentId{id=123456789}","reason":"Not Found"}