.decode data prior to json.loads in utils.http.get_url
This commit is contained in:
parent
951c315cec
commit
f286f3bf48
1 changed files with 1 additions and 2 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue