atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

API auth with token not working, password auth depreciation message

Open batou069 opened this issue 1 year ago • 0 comments

I discovered atlassian-python-api and an new to this, couldn't find answers online so am asking here:

I try to connect to our confluence cloud instance lets name it https://company.atlassian.net/wiki/ via google colab I am admin in all the spaces I'm interested in

!pip install atlassian-python-api

from atlassian import Confluence

confluence = Confluence(
    url="https://company.atlassian.net/wiki",
    username="[email protected]"
    password="<jira_api_token>"
    cloud=True)

content = confluence.get_page_by_id(page_id=123456789)

print(content)

I'm always getting either "wrong auth" or "password auth is deprecated" error message. In order to do an confluence API call with curl via the terminal I needed to base64 encode my email:apitoken combination and use this new token with basi auth header like this:

curl --location --request GET 'https://company.atlassian.net/wiki/rest/api/content/search?cql={some_cql_query}%20AND%20type=page&limit=50&expand=body.storage' \
--header "Authorization: Basic "<base64_encoded_new_token>"\
-H "Content-Type: application/json"

How can I do this with the python API? I did find this which I believe are all the packages functions, but not understanding from this what the parameters should be i only see arg and kargs.

Thanks

batou069 avatar Mar 22 '23 08:03 batou069