teamcity
teamcity copied to clipboard
Method is not working due to headers
As we can find in TeamCity documentation there is specific method to get/update some project paramteres:
Project name/description/archived status: GET/PUT http://teamcity:8111/app/rest/projects/<projectLocator>/<field_name> (accepts/produces text/plain) where <field_name> is one of "name", "description", "archived".
It accepts only text/plain
headers that's why it's not really easy to use this method with current version of client.
def set_description(tc, locator, description):
old_default_headers = tc.default_headers.copy()
tc.set_default_header(header_name='Content-type', header_value='text/plain')
tc.set_default_header(header_name='Accept', header_value='text/plain')
result = tc.projects.set_project_filed(project_locator=locator, field='description',
body=description)
tc.default_headers = old_default_headers.copy()
del (old_default_headers)
Probably, this method should be updated and this kind of issues with specific headers also handled by client.