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

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

Bekim Disha Feb 25, 2016

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

 

Bekim

1 answer

2 votes
Steffen Opel [Utoolity] Community Leader Feb 26, 2016

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.

Johannes Kilian Feb 28, 2016

Unfortunately this is only for Bitbucket Cloud ...

 

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Next-gen

Introducing subtasks for breaking down work in next-gen projects

Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...

2,656 views 14 17
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