Hello all,
I am able to get information from a single project using the python api as seen in this code snippet:
import os from atlassian import Bamboo BAMBOO_URL = os.environ.get("BAMBOO_URL", "http://bamboo.name.com/") ATLASSIAN_USER = os.environ.get("ATLASSIAN_USER", "admin") ATLASSIAN_PASSWORD = os.environ.get("ATLASSIAN_PASSWORD", "admin") bamboo = Bamboo(url=BAMBOO_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD) print(bamboo.project("projectName"))
but I can't get it to list all projects like this:
import os
from atlassian import Bamboo
BAMBOO_URL = os.environ.get("BAMBOO_URL", "http://bamboo.name.com/")
ATLASSIAN_USER = os.environ.get("ATLASSIAN_USER", "admin")
ATLASSIAN_PASSWORD = os.environ.get("ATLASSIAN_PASSWORD", "admin")
bamboo = Bamboo(url=BAMBOO_URL, username=ATLASSIAN_USER, password=ATLASSIAN_PASSWORD)
print(bamboo.projects(expand=None, favourite=False, clover_enabled=False, max_results=25))
any ideas on what I'm doing wrong?
Hi
Do you have any error message ?
Seems to be the right function
https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/bamboo.py
I don't get an error message, however all that is returned is
<generator object Bamboo._get_generator at 0x000002988A054B30>
compared to the single result which gives me the desired result of:
{'expand': 'plans', 'key': 'myKey', 'name': 'Associated Name', 'link': {'href': 'http://bamboo.myurl.com/rest/api/latest/project/myKey', 'rel': 'self'}, 'plans': {'size': 38, 'start-index': 0, 'max-result': 25}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems that you have an answer but it return a Generator. I'm not familiar with it but you cannot use it like a list.
https://book.pythontips.com/en/latest/generators.html
You may try to copy the generator into a list
list(bamboo.projects(expand=None, favourite=False, clover_enabled=False, max_results=25))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you so much for helping. I didn't think to do that! Hopefully you have a great rest of your day.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm not familiar with python, but it seems to be possible.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.