teamcity
teamcity copied to clipboard
csrf queue new build error
When I tried to use this code:
body = Build(
build_type_id=self._tc_build_configuration_id,
branch_name=branch_name,
)
print(self._tc.build_queues.queue_new_build(body=body, move_to_top=True))
I got error:
File "C:\Users\megap\PycharmProjects\Jira2TeamCity\venv\lib\site-packages\dohq_teamcity\api_client.py", line 373, in request
body=body)
File "C:\Users\megap\PycharmProjects\Jira2TeamCity\venv\lib\site-packages\dohq_teamcity\rest.py", line 281, in POST
body=body)
File "C:\Users\megap\PycharmProjects\Jira2TeamCity\venv\lib\site-packages\dohq_teamcity\rest.py", line 232, in request
raise ApiException(http_resp=r)
dohq_teamcity.rest.ApiException: (403)
Reason:
HTTP response headers: HTTPHeaderDict({'TeamCity-Node-Id': 'MAIN_SERVER', 'Content-Type': 'text/plain;charset=UTF-8', 'Content-Length': '358', 'Date': 'Sun, 10 May 2020 15:07:48 GMT'})
HTTP response body: 403 Forbidden: Responding with 403 status code due to failed CSRF check: authenticated POST request is made, but neither tc-csrf-token parameter nor X-TC-CSRF-Token header are provided.. For a temporary workaround, you can set internal property teamcity.csrf.paranoid=false and provide valid Origin=http://asdasdasd header with your request