Closed aderbas closed 2 years ago
I suggest changing it to:
result = response.json()
if response.status_code not in (200, 201):
raise TFSClientError('TFS API returned HTTP %s (%s)' % (
response.status_code, result['error'] if 'error' in result else response.reason))
return result
@aderbas hi!
We can use response.raise_for_status()
and catch all exceptions from it.
Feel free to create a PR with the changes!
I really need the return from the request, the TFS API responds with the id and url of the file. Even if I treat the error, I won't have this information. I opened a PR but there was an error in the pre-commit, I don't understand the cause, sorry about that.
@allburov is there a sandbox or something to play with TFS API? I don't have TFS anymore
@Boltyk I don't think so, neither do I have access :(
@aderbas thank you for the contribution! I'll release a new version after migration to Github Actions https://github.com/devopshq/tfs/issues/99
I'm trying to use the
send_post()
method to upload an attachment to attach to wit, but the method is treating 201 as an error.The API returns
201 - Created
and is being treated as an error but 201 is a success status. I've been looking in the source code and found it.526 - connection.py