Forums

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

Having issues with app password working with a Python script

Steven Pennington
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!
December 14, 2020

Hello,

I am getting a 401 error when using an app password in my python script.  The script works with my username:password but not with username:appPassword.  The app password works when making the same api call in postman.  I am using Python 3.9.0. 

Note: I have also tried giving the app pw all possible permissions and still getting a 401 when using the app pw.

api call

headers = {'Content-Type''application/json ; charset=utf-8')

url = 'https://bitbucket.org/!api/2.0/repositories/{}/{}/commits'.format(campus, student_repo_name) 

call_student_repo = requests.get(url, auth('USERNAME''APPPASSWORD'), headers=headers) 

student_repo = call_student_repo.json()['values']

 

This script will be called with a Pipeline so if there is an alternative way to use the credentials in that for the api call I would be happy to explore that as well. 

Thanks

1 answer

0 votes
Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 14, 2020

Hi @Steven Pennington 

Have you tried using your email address instead of username?

Steven Pennington
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!
December 14, 2020

Still getting a 401 when running the script. When using email on postman I am now getting a 401 there as well. 

Prince Nyeche
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 19, 2020

Hey @Steven Pennington 

You might want to consider using this API wrapper  for easy usability.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events