diff options
Diffstat (limited to 'googleapiclient/model.py')
-rw-r--r-- | googleapiclient/model.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/googleapiclient/model.py b/googleapiclient/model.py index b853a4f68..b023db4dd 100644 --- a/googleapiclient/model.py +++ b/googleapiclient/model.py @@ -277,9 +277,13 @@ class JsonModel(BaseModel): content = content.decode("utf-8") except AttributeError: pass - body = json.loads(content) - if self._data_wrapper and isinstance(body, dict) and "data" in body: - body = body["data"] + try: + body = json.loads(content) + except json.decoder.JSONDecodeError: + body = content + else: + if self._data_wrapper and "data" in body: + body = body["data"] return body @property |