|
|
@ -349,11 +349,17 @@ class CloudflareAPI(object):
|
|
|
|
result = None
|
|
|
|
result = None
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
content = resp.read()
|
|
|
|
content = resp.read()
|
|
|
|
result = json.loads(content)
|
|
|
|
|
|
|
|
except AttributeError:
|
|
|
|
except AttributeError:
|
|
|
|
error_msg += "; The API response was empty"
|
|
|
|
if info['body']:
|
|
|
|
except json.JSONDecodeError:
|
|
|
|
content = info['body']
|
|
|
|
error_msg += "; Failed to parse API response: {0}".format(content)
|
|
|
|
else:
|
|
|
|
|
|
|
|
error_msg += "; The API response was empty"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if content:
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
result = json.loads(content)
|
|
|
|
|
|
|
|
except json.JSONDecodeError:
|
|
|
|
|
|
|
|
error_msg += "; Failed to parse API response: {0}".format(content)
|
|
|
|
|
|
|
|
|
|
|
|
# received an error status but no data with details on what failed
|
|
|
|
# received an error status but no data with details on what failed
|
|
|
|
if (info['status'] not in [200,304]) and (result is None):
|
|
|
|
if (info['status'] not in [200,304]) and (result is None):
|
|
|
|