.decode data prior to json.loads in utils.http.get_url

This commit is contained in:
jesopo 2018-10-10 15:25:08 +01:00
parent 951c315cec
commit f286f3bf48

View file

@ -53,14 +53,13 @@ def get_url(url, method="GET", get_params={}, post_data=None, headers={},
return response.code, soup
return soup
data = response_content
data = response_content.decode(response.encoding)
if json and data:
try:
data = _json.loads(data)
except _json.decoder.JSONDecodeError as e:
raise HTTPParsingException(str(e))
data = data.decode(response.encoding)
if code:
return response.status_code, data
else: