Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Using atlassian python confluence with microsoft authenticated account?

I am an experienced python coder and want to access Confluence via Python.  I wrote a simple 2 line script to test that I had access and found that I had not


from atlassian import Confluence

confluence = Confluence(
url='https://my_company.atlassian.net/wiki/home',
username='stephen.ellwood@my_company.com',
password='my_password')
confluence.get_all_spaces(start=0, limit=500, expand=None)

I get the result:

HTTPError: 401 Client Error: Unauthorized for url: https://my_company.atlassian.net/wiki/home/rest/api/space?limit=500

I am using the correct username and password but they are my Microsoft credentials; I do not have a direct confluence account.

Is there a different authentication method for users who use Microsoft Authenticated accounts? 

1 answer

1 accepted

1 vote
Answer accepted
Thomas Deiler Community Leader May 08, 2021

Dear @Stephen Ellwood ,

that won't work. Basic auth is not allowed anymore for cloud. You need to take the Api token for the 'password', instead.

password='rahHWQ61rElyFHmsz9H6ABv')

You can generate your own Api token here: https://id.atlassian.com/manage-profile/security/api-tokens

So long

Thomas

Thanks, I was confused by the use of the name password instead of the name token. Working now!

Thomas Deiler Community Leader May 10, 2021

Dear @Stephen Ellwood ,

'user' and 'password' are just variable names in your Python function Confluence(). You could rename them to 'email' and 'token'. The effect will be the same.

So long

Thomas

Hi @Thomas Deiler understood that "user" and "password" are [optional] parameter names for the Confluence Class instance creator.  Several instance methods are described some using the parameter "password" and others using the parameter "token". 

While I completely agree with "that which we call a Rose by any other name would smell as sweet" and am in no way wanting to sound defensive but in this case I saw "token" and "password" not used interchangeably so did not think to do so. 

Thanks again for your help. Pleased it was so easy to solve.

Suggest an answer

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

Miss the Confluence demos at Team 21? Watch them here!

Phew, Atlassian Team 2021 blew by. With dozens of demos and a handful of keynotes, you may have missed some of the awesome Confluence Cloud sessions. Don't' worry, you can watch them all here or on Y...

283 views 2 6
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