1

Getting the issue below, I can get the repositories but when I try get the commit's, that is when it fails and I get a 401. Repo's and workspace are private so the first one would fail I imagine if there was an issue with the code entirely. Anyone done this recently?

baseUrlv2 = "https://bitbucket.org/api/2.0"
role = "contributor"
username = {bitbucket_username}
password = {bitbucket_app_password}

r = requests.get("{base}/repositories/{workspace}?role={role}".format(base=baseUrlv2, role=role),
    auth=(use
rname, password))

repos = r.json() 

while 'next' in repos:
    for repo in repos["values"]:
        commitLink = repo["links"]["commits"]["href"]
        repoSlug = repo["slug"]
        #the request below seems to be the issue :\
        r = requests.post((commitLink), auth=(username,password))
        
        c = r.json() #this is where it breaks
torek
  • 448,244
  • 59
  • 642
  • 775
momo
  • 21
  • 4

1 Answers1

1

After a bunch of trial and error wherein the Atlassian documentation says use your Bitbucket username + App Password.. This wasn't the case. You need to use your normal email and password to actually use the API.

Some strange issues in general with the API calls for Bitbucket but this issue is resolved.

momo
  • 21
  • 4