atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

bitbucket.repo_list documentation unclear

Open volviq opened this issue 3 years ago • 2 comments

The documentation in bitbucket.rst shows the function: bitbucket.repo_list(project_key, limit=25) It does not describe to handle the output of the function. If I run that command and assign the output to "result" and try to print that, it shows a generator object: <generator object BitbucketBase._get_paged at 0x0000021F7C0703C0>

Unfortunately it is absolutely unclear to me, how to decode and use the stored information in this object. Can this be better documented please?

volviq avatar Oct 19 '22 14:10 volviq

@volviq, i had to invoke some logging to figure out the archaic terminal output. try this ... copy the code between the 'tilda' save it to a file called "access-stash.py" this should at least give yo a working baseline... after that it's all dev-- ` ##include Libs from atlassian import Stash import logging

##logging for terminal logging.basicConfig(filename='conf_connect4.log', filemode='w', level=logging.DEBUG)

##const for readability and testing pyToken = 'somePersonalTokenfrom stash' pyName = 'pybot4'

try: stash = Stash(url="<change me of course....... https://stash.buisnessUrl.com>", token=pyToken) data = stash.project('PROJECTNAME') target = stash.get_repositories print(data) print(target) except Exception as e: logging.error(e) `

zimmermanjosh avatar Oct 20 '22 13:10 zimmermanjosh

The documentation in bitbucket.rst shows the function: bitbucket.repo_list(project_key, limit=25) It does not describe to handle the output of the function. If I run that command and assign the output to "result" and try to print that, it shows a generator object: <generator object BitbucketBase._get_paged at 0x0000021F7C0703C0>

Unfortunately it is absolutely unclear to me, how to decode and use the stored information in this object. Can this be better documented please?

A generator is used in a for loop or converted to a list:

for r in bitbucket.repo_list(project_key, limit=25):
    print(str(r))
# or
print(str(list(bitbucket.repo_list(project_key, limit=25)))

The preferred way is looping over the entries and to use repo_all_list to get all entries.

Spacetown avatar Nov 07 '22 20:11 Spacetown