Editing to create a minimal reproducible example: I am importing bitbucket and Bitbucket because even though the docs indicate 'bitbucket', I get errors that there is no attribute for repo_list; see below My code is:
from atlassian import Bitbucket
from atlassian import bitbucket
from atlassian.bitbucket import Cloud
bitbucket_username = 'username'
scraper_token = 'token'
Bitbucket_app_pw = Cloud(
username=bitbucket_username,
password=scraper_token,
cloud=True)
try:
repo_list = bitbucket.repo_list("SOL")
print(repo_list)
projects = bitbucket.project_list(Bitbucket_app_pw)
print(projects)
data = bitbucket.project("SOL")
print(data)
project_info = bitbucket.project("SOL")
print(project_info)
except AttributeError:
project_key = "SOL"
repo_list = Bitbucket.repo_list("SOL")
print(repo_list)
projects = Bitbucket.project_list(Bitbucket_app_pw)
print(projects)
data = Bitbucket.project("SOL")
print(data)
project_info = Bitbucket.project("SOL")
print(project_info)
My error is:
Traceback (most recent call last):
File "C:\Users\name.name\PycharmProjects\bitbucket scraper\main.py", line 16, in <module>
repo_list = bitbucket.repo_list("SOL")
AttributeError: module 'atlassian.bitbucket' has no attribute 'repo_list'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\name.name\PycharmProjects\bitbucket scraper\main.py", line 28, in <module>
repo_list = Bitbucket.repo_list("SOL")
TypeError: Bitbucket.repo_list() missing 1 required positional argument: 'project_key'
Original Question_
I am trying to log into a Atlassian BitBucket repository using the App Password, and it looks like I am in. But when I try to get a list of repositories in a project (using https://atlassian-python-api.readthedocs.io/bitbucket.html), I keep on getting an error. For example, the project key that I am trying to access is 'SOL'. So when I run:
Bitbucket.project_list('SOL')
I get an error:
AttributeError: 'str' object has no attribute '_url_projects'
Not sure what I am doing wrong here. Any advice? TIA!
Editing after people left helpful comments: So when I tried the suggestion given by AKX:
data = bitbucket.project("SOL")
print(data)
The response was:
AttributeError: module 'atlassian.bitbucket' has no attribute 'project'