The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with Python API access to Confluence Cloud

Balasubramaniam Theetharappam
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 15, 2024

Hello,

 I am currently working on a Python script that will connect to the Confluence cloud and create a page in my Confluence space. However, I am having an issue with the authorization process. I did try to authenticate using my email and API Token using both the request library and python-atlassian-api library to connect to the confluence cloud, but I am getting following error:

HTTPSConnectionPool(host='company.atlassian.net', port=443): Max retries exceeded with url: /wiki/rest/api/space?limit=500 (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x0000029414B3A710>, 'Connection to one-atlas-umzg.atlassian.net timed out. (connect timeout=75)'))

Python code using Request Library:

from requests.auth import HTTPBasicAuth
import requests

def
authenticate(username, password, url):
auth = HTTPBasicAuth(username, password)
headers = {"Accept": "application/json",'Content-Type': 'application/json', 'X-Atlassian-Token': 'no-check'}
res = requests.get("https://one-atlas-umzg.atlassian.net/wiki", auth=auth, headers=headers)
print(res.status_code)


Python code using Request Library:

from atlassian import Confluence
def authenticate(username, password, url):
confluence = Confluence("https://one-atlas-umzg.atlassian.net/wiki", username=username, password=password, cloud=True)
confluence.get_all_spaces()

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events