Commit 8af29e28 authored by Bruno Duyé's avatar Bruno Duyé

Minor - download: add response head to log message when json decode fails

parent 9db16fba
Pipeline #15529 failed with stage
in 13 minutes and 12 seconds
......@@ -224,8 +224,9 @@ def get_from_api(url, raise_on_errors=True):
try:
content_dict = json.loads(content_str)
except Exception as e:
response_head = content_str[:400]
log.exception(
"API call: {!r}\nException during conversion of API result to json. Result saved to last_api_result.json file.".format(url))
"API call: {!r}\nException during conversion of API result to json. Full result saved to last_api_result.json file.\nHere's the head of the answer:".format(url, response_head))
with open('last_api_result.json', 'wb') as _f:
_f.write(content_str)
raise e
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment