diff --git a/datalab/utils/_http.py b/datalab/utils/_http.py index 62fc0a2fe..3f062bef3 100644 --- a/datalab/utils/_http.py +++ b/datalab/utils/_http.py @@ -144,13 +144,12 @@ def request(url, args=None, data=None, headers=None, method=None, method=method, body=data, headers=headers) + content = content.decode() if 200 <= response.status < 300: if raw_response: return content - if type(content) == str: - return json.loads(content) else: - return json.loads(str(content, encoding='UTF-8')) + return json.loads(content) else: raise RequestException(response.status, content) except ValueError: diff --git a/google/datalab/utils/_http.py b/google/datalab/utils/_http.py index d5cc55632..06e5fbc49 100644 --- a/google/datalab/utils/_http.py +++ b/google/datalab/utils/_http.py @@ -147,13 +147,12 @@ def request(url, args=None, data=None, headers=None, method=None, method=method, body=data, headers=headers) + content = content.decode() if 200 <= response.status < 300: if raw_response: return content - if type(content) == str: - return json.loads(content) else: - return json.loads(str(content, encoding='UTF-8')) + return json.loads(content) else: raise RequestException(response.status, content) except ValueError: