Fix crash on bad response
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Michel Roux 2020-10-21 23:16:56 +02:00
parent 4fa3f91a32
commit f38bc0b426

View File

@ -117,9 +117,10 @@ def curl_content(url, params=None, ajax=False, debug=True):
'postData': '%s' % urlencode(params) if (method == 'post') else ''
}))
response = loads(json_response.text)
output = response['solution']['response']
http_code = json_response.status_code
response = loads(json_response.text)
if 'solution' in response:
output = response['solution']['response']
if debug and http_code != 200:
getLogger().exception('%s\n\n%s' % (str(e), json_response.text))