I'm trying to connect to my bitbucket cloud account using python so that I can write a script to create a repository. However, when I am trying to connect using the below code, it keeps giving me a 401 login failed, despite me trying variations of username, email, password and app_password. Has anyone got an ideas as to why is isn't working?
----CODE BELOW----- def main(config): print("1")
headers = {"Content-Type": 'application/json', "Authorization": config["BITBUCKET"]["app_password"]}
auth = (config["BITBUCKET"]["username"], config["BITBUCKET"]["password"])
bb_base_url = f'https://api.bitbucket.org/2.0/repositories/'
print("2")
res = requests.get(bb_base_url, auth=auth, headers=headers)
print("3")
print(res.status_code)
print(res.text)
-----ERROR MESSAGE----
401
Login failed due to incorrect login credentials or method.
For information on authentication methods for Bitbucket Cloud APIs, visit:
https://developer.atlassian.com/cloud/bitbucket/rest/intro/#authentication
If you are unsure of which login details or login method to use, visit:
https://support.atlassian.com/bitbucket-cloud/docs/log-into-or-connect-to-bitbucket-cloud/
...........................