I want use python to get and create repository, and i have create a new App passwords with full auth. I always get wrong status code 401, please help me.
my python code:
username = "xxx"
app_password = "xxx"
bitbucket_api_url = "https://api.bitbucket.org/2.0/repositories/"
def check_bitbucket_repo(repo_slug):
response = requests.get(urljoin(bitbucket_api_url, f"{bitbucket_workspace}/{repo_slug}"), auth=(username, app_password)) #, proxies=proxies #return response.status_code == 200
if response.status_code == 200:
log_message(f"Repository {repo_slug} exists in Bitbucket")
return True
else:
log_message(f"Repository {repo_slug} does not exist in Bitbucket. Status code: {response.status_code}")
return False