How can I authenticate with bitbucket via REST api in python?

I am trying to create a python client and authenticate so that I can write some code to access repositories, projects etc ... I can not find any REST-API documentation on which URL-s to hit with REST tools. 

Can you please help me by directing me to any examples or documentations?


Thank you



1 answer

2 votes

You can find an overview how authentication works in the Bitbucket Connect developer documentation.

By chance @Ian Buchanan has just published a great blog post about Doing the Bitbucket OAuth dance with Python, which implements the authentication flow solely based on REST API calls, illustrating that it is often just as easy to use simple HTTP client libraries rather than a dedicated API wrapper library.

This seems to nicely cover what you want to achieve, however, with PyBitbucket there is in fact such a dedicated Python wrapper for the Bitbucket Cloud REST API, once again maintained by @Ian Buchanan (not yet officially listed as a related library within Bitbucket Connect sample code though, I don't know whether there's a reason for this).

Ian Buchanan Atlassian Team Feb 26, 2016

Thanks for answer! The OAuth article was the result of what I had learned while trying to implement OAuth 2.0 in PyBitbucket. When I can find the time to wrap up that OAuth 2.0 work and clean-up the hard-coding of URLs, then I'll feel pretty good about calling it a 1.0 release and getting it officially listed.

That said, the PyBitbucket library has pretty full functionality and is already used in other projects like mercurial-bitbucketize. If it's missing something you need, log an issue or send a pull request. I do my best to respond quickly.

Unfortunately this is only for Bitbucket Cloud ...


Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Friday in United States

Confluence Security Advisory

Good morning Members, Not sure if you are aware. Please read the following: More details: https://co...

43 views 1 0
View post

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you