diff --git a/swh/core/api/serializers.py b/swh/core/api/serializers.py --- a/swh/core/api/serializers.py +++ b/swh/core/api/serializers.py @@ -5,7 +5,7 @@ import base64 import datetime -from json import JSONDecoder, JSONEncoder +import json import types from uuid import UUID @@ -28,7 +28,7 @@ if content_type.startswith('application/x-msgpack'): r = msgpack_loads(response.content) elif content_type.startswith('application/json'): - r = response.json(cls=SWHJSONDecoder) + r = json.loads(response.text, cls=SWHJSONDecoder) else: raise ValueError('Wrong content type `%s` for API response' % content_type) @@ -36,7 +36,7 @@ return r -class SWHJSONEncoder(JSONEncoder): +class SWHJSONEncoder(json.JSONEncoder): """JSON encoder for data structures generated by Software Heritage. This JSON encoder extends the default Python JSON encoder and adds @@ -101,7 +101,7 @@ return list(iterable) -class SWHJSONDecoder(JSONDecoder): +class SWHJSONDecoder(json.JSONDecoder): """JSON decoder for data structures encoded with SWHJSONEncoder. This JSON decoder extends the default Python JSON decoder,