Hello guys.
I want to access Confluence (Cloud) using Python.
These are the steps I'm following:
confluence = Confluence(
url='https://xxxxx.xxxx.net',
username='<my_user>',
password='<my_token>',
verify_ssl=False,
cloud=True
)
def main_process():
nRet = 0
cInp = ''
os.system('clear')
try:
cPage = confluence.page_exists('DBM', 'General', type=None)
print(cPage)
except Exception as e:
logging.error(e)
And the error log shows this:
DEBUG :06/13/2023 05:39:05 curl --silent -X GET -H 'Content-Type: application/json' -H 'Accept: application/json' 'https://xxxxx.xxx.net/rest/api/content?spaceKey=DBM&title=General'
DEBUG :06/13/2023 05:39:05 Starting new HTTPS connection (1): xxxxx.xxx.net:443
DEBUG :06/13/2023 05:39:09 https://xxxxx.xxx.net:443 "GET /rest/api/content?spaceKey=DBM&title=General HTTP/1.1" 401 751
DEBUG :06/13/2023 05:39:09 HTTP: GET rest/api/content -> 401
DEBUG :06/13/2023 05:39:09 HTTP: Response text -> <!doctype html><html lang="en"><head><title>HTTP Status 401 – Unauthorized</title><style type="text/css">body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 401 – Unauthorized</h1><hr class="line" /><p><b>Type</b> Status Report</p><p><b>Message</b> Basic Authentication Failure - Reason : AUTHENTICATED_FAILED</p><p><b>Description</b> The request has not been applied because it lacks valid authentication credentials for the target resource.</p><hr class="line" /><h3>Apache Tomcat/9.0.71</h3></body></html>
ERROR :06/13/2023 05:39:09 Expecting value: line 1 column 1 (char 0)
ERROR :06/13/2023 05:39:09 401 Client Error: for url: https://xxxxx.xxx.net/rest/api/content?spaceKey=DBM&title=General
It looks like even with the PTA I still need something else or there is a kind of restriction that I do not understand.
Any help will be much appreciated.
Regards
Javier
Hello.
Forgot to add my installation ...
Regards
Javier
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.