devopshq / teamcity

dohq-teamcity is a Python package providing access to the JetBrains TeamCity server API.
https://devopshq.github.io/teamcity/
MIT License
33 stars 12 forks source link

vcs_root_api.serve_property returns 406 for valid property names #27

Open npaul3 opened 3 years ago

npaul3 commented 3 years ago

I'm trying to retrieve property values for vcs_roots like this:

vcs_root_location = root_id scm_url = con.vcs_root_api.serve_property(vcs_root_locator,'url') # Also tried with 'username' and 'branch'

It always returns 406. Am I sending it in wrong format?

Complete stack trace:

Traceback (most recent call last): File "list_projects.py", line 84, in <module> list_root_props(root.id) File "list_projects.py", line 60, in list_root_props stash_url = con.vcs_root_api.serve_property(vcs_root_locator,'url') File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dohq_teamcity/api/vcs_root_api.py", line 279, in serve_property (data) = self.__serve_property_with_http_info(vcs_root_locator, name, **kwargs) # noqa: E501 File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dohq_teamcity/api/vcs_root_api.py", line 1288, in __serve_property_with_http_info collection_formats=collection_formats) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dohq_teamcity/custom/client.py", line 69, in call_api return super(TeamCity, self).call_api(*args, **kwargs) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dohq_teamcity/api_client.py", line 322, in call_api _preload_content, _request_timeout) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dohq_teamcity/api_client.py", line 153, in __call_api _request_timeout=_request_timeout) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dohq_teamcity/api_client.py", line 351, in request headers=headers) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dohq_teamcity/rest.py", line 244, in GET query_params=query_params) File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/dohq_teamcity/rest.py", line 232, in request raise ApiException(http_resp=r) dohq_teamcity.rest.ApiException: (406) Reason: HTTP response headers: HTTPHeaderDict({'Date': 'Fri, 30 Oct 2020 16:46:40 GMT', 'Content-Type': 'text/plain', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'Set-Cookie': 'AWSALB=sM/GgBMXEUo6F6BIHG8Z1pyDZZiVu6PbeDFTkT0nfNA3ESBIESaVVWTZraJaqs/YeEQoL5OWazF+7ljrIV9RM6gWoEq9a0/MTVANoVtjqnt3mtzsVMDzgFSULlI8; Expires=Fri, 06 Nov 2020 16:46:40 GMT; Path=/, AWSALBCORS=sM/GgBMXEUo6F6BIHG8Z1pyDZZiVu6PbeDFTkT0nfNA3ESBIESaVVWTZraJaqs/YeEQoL5OWazF+7ljrIV9RM6gWoEq9a0/MTVANoVtjqnt3mtzsVMDzgFSULlI8; Expires=Fri, 06 Nov 2020 16:46:40 GMT; Path=/; SameSite=None; Secure, TCSESSIONID=012B9FE908ECBD09A37141CFD21C870F; Path=/; Secure; HttpOnly, RememberMe=; Max-Age=0; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly', 'Server': 'nginx', 'Content-Security-Policy': "frame-ancestors 'self'", 'TeamCity-Node-Id': 'MAIN_SERVER', 'Cache-Control': 'no-store'}) HTTP response body: Responding with error, status code: 406 (Not Acceptable). Make sure you have supplied correct 'Accept' header.