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

 

Bekim

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
Published Thursday in Agile

How Scrum works? It starts with training and education

To answer “How scrum works,” most of the teams I've worked with first addressed the question: “where to start?”  That question applies to both implementation and improvements on the Scrum framew...

184 views 3 5
Read article

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