Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to connect to bitbucket from Python

TestBucketa
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 5, 2019

Hi,

I'm green so need help. How oh how I can connect correctly from my script to Bitbucket to create / delete repositories (for now).

Habe so far this:

import requests
username =
'user@mail.com'
password = 'password'

headers = {"Content-Type": 'application/json'}
auth = (username
, password)
bb_base_url =
f"https://api.bitbucket.org/2.0/repositories/username/reponame"
res = requests.put(bb_base_url, headers=headers, auth=auth)
print(res)

Geting 401 code in responce. With same code just instead of put I'm using delete method I can delete repository created via web browser... What i'm doing wrong?

1 answer

0 votes
Ana Retamal
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 8, 2019

Hi, welcome to the Community!

For questions like this one, I recommend you to visit our Developer Community. 

The users there are more familiar with this topic and you'll have more chances to find a suitable response. 

Hope that helps,

Ana

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events