# 1. Test if response body contains sth.
if response.text:
# ...
# 2. Handle error if deserialization fails (because of no text)
try:
responses=response.json()
# ...
except ValueError:
# no JSON returned
# 3. check that .json() did NOT return an empty dict
if responses:
# ...
Created
November 8, 2017 09:28
-
-
Save snowch/4819063186a979d2c8c822a8e3264a4f to your computer and use it in GitHub Desktop.
python requests returning no data
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment