Skip to content

Method is not working due to headers #13

@smartfin

Description

@smartfin

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//<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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions