keep json None fo row

This commit is contained in:
Kenneth Reitz
2012-12-16 22:06:03 -05:00
parent 8b141b326a
commit 7ec0170a00
+8 -4
View File
@@ -1048,10 +1048,14 @@ class Response(BaseResponse):
# a best guess).
encoding = guess_json_utf(self.content)
if encoding is not None:
return json.loads(self.content.decode(encoding))
return json.loads(self.text or self.content)
try:
return json.loads(self.content.decode(encoding))
except (ValueError, UnicodeDecodeError):
pass
try:
return json.loads(self.text or self.content)
except ValueError:
return None
@property
def links(self):