0

I'm using the module https://github.com/atlassian-api/atlassian-python-api to work on Bitbucket server with python. In their doc, they show a simple way to authenticate:

from atlassian import Bitbucket
bitbucket = Bitbucket(
    url='http://localhost:7990',
    username='admin',
    password='admin')
data = bitbucket.project_list()
print(data)

However, I'm not getting what url I should specify. Can you please help me with a practical example? Also, on this doc https://atlassian-python-api.readthedocs.io/index.html there are listed alternative ways to authenticate, if you know any more recommended method please let me know.

  • Are you trying to authenticate to Bitbucket Server/Data Center (you would host this on your own servers), or to Bitbucket Cloud (https://bitbucket.org)? The example you've included indicates a self-hosted instance of Bitbucket Server/DC. The answer to your question depends on which you're using. Notice in the page you linked, further down is a different example for Bitbucket Cloud auth using OAuth2 (look for `from atlassian.bitbucket import Cloud`). – daveruinseverything Jan 28 '22 at 21:45

1 Answers1

0

Currently you need to use api password and slug in order to login.

slug get from your repository url:

https://bitbucket.org/{slug}/workspace/repositories

app password you can create here:

https://bitbucket.org/account/settings/app-passwords/

Then login like this:

from atlassian.bitbucket import Cloud

cloud = Cloud(url="https://api.bitbucket.org/", username=slug, password=app_password)
Zaraki Kenpachi
  • 5,510
  • 2
  • 15
  • 38
  • @Samuel Liew .This is right place for this answer, the preview one was misplaced. Don't delete proper solution if there any or you can't provide better one. – Zaraki Kenpachi Apr 18 '23 at 09:39