atlassian-python-api
atlassian-python-api copied to clipboard
Error while Listing Bitbucket Cloud Projects using atlassian-python-api
The API I'm using to list Bitbucket Cloud projects doesn't seem to work as expected. I'm following the documentation here: https://atlassian-python-api.readthedocs.io/bitbucket.html#bitbucket-cloud
Steps to Reproduce:
Use the following code to create a connection and list projects:
from atlassian import Bitbucket
bitbucket = Bitbucket(
url='https://api.bitbucket.org',
username='xxxx',
password='xxxx',
cloud=True)
data = list(bitbucket.project_list())
print(data)a
Actual Behavior: However, when I run the code, I get the following error:
HTTPError Traceback (most recent call last)
Cell In[30], line 9
1 from atlassian import Bitbucket
3 bitbucket = Bitbucket(
4 url='https://api.bitbucket.org/',
5 username='xxxx',
6 password='xxxx',
7 cloud=True)
----> 9 data = list(bitbucket.project_list())
12 print(data)
File ~/.local/lib/python3.8/site-packages/atlassian/bitbucket/base.py:66, in BitbucketBase._get_paged(self, url, params, data, flags, trailing, absolute)
63 params = {}
65 while True:
---> 66 response = self.get(
67 url,
68 trailing=trailing,
69 params=params,
70 data=data,
71 flags=flags,
72 absolute=absolute,
73 )
74 if "values" not in response:
75 return
File ~/.local/lib/python3.8/site-packages/atlassian/rest_client.py:285, in AtlassianRestAPI.get(self, path, data, flags, params, headers, not_json_response, trailing, absolute, advanced_mode)
260 def get(
261 self,
262 path,
(...)
270 advanced_mode=False,
271 ):
272 """
273 Get request based on the python-requests module. You can override headers, and also, get not json response
274 :param path:
(...)
283 :return:
284 """
--> 285 response = self.request(
286 "GET",
287 path=path,
288 flags=flags,
289 params=params,
290 data=data,
291 headers=headers,
292 trailing=trailing,
293 absolute=absolute,
294 advanced_mode=advanced_mode,
295 )
296 if self.advanced_mode or advanced_mode:
297 return response
File ~/.local/lib/python3.8/site-packages/atlassian/rest_client.py:257, in AtlassianRestAPI.request(self, method, path, data, json, flags, params, headers, files, trailing, absolute, advanced_mode)
254 if self.advanced_mode or advanced_mode:
255 return response
--> 257 self.raise_for_status(response)
258 return response
File ~/.local/lib/python3.8/site-packages/atlassian/rest_client.py:487, in AtlassianRestAPI.raise_for_status(self, response)
485 response.raise_for_status()
486 else:
--> 487 raise HTTPError(error_msg, response=response)
488 else:
489 response.raise_for_status()
HTTPError:
The error traceback indicates an issue with the HTTP request.
Additional Information:
Library Version: atlassian-python-api 3.40.1 Python Version: Python 3.8.10 Operating System: Ubuntu 20.04.5 LTS Relevant URLs: The URL of the API documentation you're following: https://atlassian-python-api.readthedocs.io/bitbucket.html#bitbucket-cloud, https://atlassian-python-api.readthedocs.io/, https://developer.atlassian.com/cloud/bitbucket/rest/intro/
Any assistance in identifying the cause of this issue and potential solutions would be greatly appreciated.