Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to fetch Confluence data using atlassian python wrapper

Hi Team,

 

I am using below python code to get some confluence page data , but i am getting 401 CLient error .

Please suggest.

from atlassian import Confluence

confluence = Confluence(
url='https://myconfluence.domain.com',
username='companyemailid',
password='APItokengenerated')

# If you know Space and Title
content1 = confluence.get_page_by_title(space="DOSNI", title="Airflow")

print(content1)



Error

requests.exceptions.HTTPError: 401 Client Error: for url: https://url/rest/api/content?start=0&limit=1&spaceKey=DOSNI&title=Airflow

 

1 answer

1 accepted

0 votes
Answer accepted
Prince Nyeche Community Leader Dec 14, 2020

Hi @Rajani Gutta 

Welcome to Community! What's your hosted platform? are you using Cloud or Self-hosted. If it's the latter you might want to specify the direct URL where your confluence is installed and stick to username and password. Otherwise if it's Cloud use 

https://myconfluence.atlassian.net/wiki

Then  generate your API token and use with your email Address.

Hi @Prince Nyeche ,

Thanks a lot for the quick reply, I dont have atlassian.net in the url , so I think confluence is hosted on prem Dataserver.

I started initially by trying username as password in atlassian module like below .

from atlassian import Confluence

confluence = Confluence(
url='https://myconfluence.companyname.com',
username='myid',
password='password')


But it also threw 401 Error.

Just to add, we have ping federated integrated as two factor authentication .
So after first authentication with username and password, we need to provide ping id also which we received as SMS to login to confluence .

Can you please let me know in such cases , how can i fetch data using REST API , or if there is any other way for fetching data .

'

Prince Nyeche Community Leader Dec 14, 2020

That would be a problem then, 2FA will definitely block the authentication from working. Server Products doesn't use an API key which bypasses 2FA features. Alternatively, I believe this framework supports OAuth. Something you could configure on your Server if you possess the access.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

Announcing Team Calendars in Confluence Data Center

Hi Community! We're thrilled to share that Team Calendars for Confluence is now a built-in feature for Confluence Data Center releases 7.11 and beyond.  A long time favorite,  Team Cale...

82 views 0 3
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you