Skip to content
Snippets Groups Projects
Commit a6c780f2 authored by Jo Sama's avatar Jo Sama :scream:
Browse files

Rework the put_update_batch() interface

This commit makes the interface of put_update_batch() quit similar to
post_new_batch().
parent adcdadb7
No related branches found
No related tags found
1 merge request!24Rework the put_update_batch() interface
Pipeline #94045 passed
......@@ -386,13 +386,18 @@ class SetraClient(object):
data=batchdata.json(exclude_unset=True),
headers=headers,
return_response=True)
try:
content = response.json()
except requests.exceptions.JSONDecodeError:
content = response.content
if response.status_code == 204:
return response.content, 'No Content'
return 'Accepted', {}
elif response.status_code == 409:
return response.content, 'batch_found_but_cannot_be_updated'
return 'Conflict', content
else:
response.raise_for_status()
return response
return 'Unknown', {'code': response.status_code, 'content': content}
def get_batch_complete(self, batch_id: str):
"""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment