1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00
Files
vcrpy/vcr/serializers/jsonserializer.py
2023-08-01 08:53:31 -03:00

19 lines
445 B
Python

import json
def deserialize(cassette_string):
return json.loads(cassette_string)
def serialize(cassette_dict):
error_message = (
"Does this HTTP interaction contain binary data? "
"If so, use a different serializer (like the yaml serializer) "
"for this request?"
)
try:
return json.dumps(cassette_dict, indent=4) + "\n"
except TypeError:
raise TypeError(error_message) from None