atlassian-api / atlassian-python-api

Atlassian Python REST API wrapper
https://atlassian-python-api.readthedocs.io
Apache License 2.0
1.37k stars 662 forks source link

bamboo.activity() returns 404 #1362

Open timakamystery opened 7 months ago

timakamystery commented 7 months ago
BAMBOO_URL = 'https://bamboo.example.com'
token = 'xxx'
bamboo = Bamboo(url=BAMBOO_URL, token=token)
...
bamboo.activity()
Traceback (most recent call last):
  File "/Users/tshklyarov/repos/node-api/prune.py", line 37, in <module>
    agent_status = bamboo.activity()
  File "/Users/tshklyarov/repos/node-api/venv/lib/python3.9/site-packages/atlassian/bamboo.py", line 1098, in activity
    return self.get("build/admin/ajax/getDashboardSummary.action")
  File "/Users/tshklyarov/repos/node-api/venv/lib/python3.9/site-packages/atlassian/rest_client.py", line 340, in get
    response = self.request(
  File "/Users/tshklyarov/repos/node-api/venv/lib/python3.9/site-packages/atlassian/rest_client.py", line 312, in request
    self.raise_for_status(response)
  File "/Users/tshklyarov/repos/node-api/venv/lib/python3.9/site-packages/atlassian/rest_client.py", line 547, in raise_for_status
    response.raise_for_status()
  File "/Users/tshklyarov/repos/node-api/venv/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error:  for url: https://bamboo.example.com/build/admin/ajax/getDashboardSummary.action

Compared to bamboo.agent_status(), which provides a response. But I need active agents, while agent_status() provides some list of inactive old agents hence trying to use activity() instead to see not building agents.

Also tried using rest api, but it doesn't show if an agent busy/not..

curl -H "Authorization: Bearer XXX" https://bamboo.example.com/rest/api/latest/agent/123456/status
{"online": "true"}%

atlassian_python_api-3.41.11

timakamystery commented 7 months ago

was able to resolve my task using plugin: Bamboo Command Line Interface (CLI), but resolving / advising on this issue would be appreciated