From f286f3bf48f906340190c5569b57fb7e4494897b Mon Sep 17 00:00:00 2001 From: jesopo Date: Wed, 10 Oct 2018 15:25:08 +0100 Subject: [PATCH] .decode data prior to json.loads in utils.http.get_url --- src/utils/http.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/utils/http.py b/src/utils/http.py index 9176fe20..d8b96dc7 100644 --- a/src/utils/http.py +++ b/src/utils/http.py @@ -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: