added a little piece of code to stop Utils.get_url trying to json decode an empty string.

This commit is contained in:
jesopo 2016-03-30 19:32:47 +01:00
parent d8cce800d1
commit 810ba3f0bb
No known key found for this signature in database
GPG key ID: 0BBDEB2AEFCFFCB3

View file

@ -86,7 +86,7 @@ def get_url(url, **kwargs):
break break
response_content = response_content.decode(encoding or "utf8") response_content = response_content.decode(encoding or "utf8")
data = response_content data = response_content
if kwargs.get("json"): if kwargs.get("json") and data:
try: try:
data = json.loads(response_content) data = json.loads(response_content)
except json.decoder.JSONDecodeError: except json.decoder.JSONDecodeError: