Deepomatic / deepomatic-client-python

Python Client
Other
14 stars 0 forks source link

Client crashes when no body in response #98

Closed Alexis-Jacob closed 3 years ago

Alexis-Jacob commented 3 years ago

When I was pushing data with a post to an API who wasn't returning a body. The client have a problem:

    self._helper.post(request, data=project_header)
  File "/usr/local/lib/python3.6/dist-packages/deepomatic/api/http_helper.py", line 307, in post
    return self.make_request(self.session.post, resource, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/deepomatic/api/http_helper.py", line 286, in make_request
    elif 'application/json' in response.headers['Content-Type']:
  File "/usr/local/lib/python3.6/dist-packages/requests/structures.py", line 54, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'content-type'

This can be reproduce by having an API returning with drf something such as: (the API is wrong aswell)

return Response(status_code=201)
maingoh commented 3 years ago

It was fixed a few time ago, just updating should fix the issue https://github.com/Deepomatic/deepomatic-client-python/pull/89