Closed
Description
Issue Summary
Response.to_dict
fails to create dict.
Steps to Reproduce
- Make request (in my case, using the sendgrid lib
response = sg.client.mail.send.post(request_body=mail.get())
- Call
response.to_dict
The email successfully is sending and the response is the 202 variant - the error seems to be in deccoding the Response.body
.
Stack Trace
Some of the stack has been omitted (things leading up to the response).
Traceback (most recent call last):
... stuff leading up to the call
File "/Users/me/my_file.py", line 48, in general_request
r = response.to_dict
File "/Users/me/venv/lib/python3.6/site-packages/python_http_client/client.py", line 55, in to_dict
return json.loads(self.body.decode('utf-8'))
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)