Cattrs

Utilities to break down CachedResponse objects into python builtin types using cattrs. This does the majority of the work needed for any serialization format.

CattrStage

Base serializer class that does pre/post-processing with cattrs.

init_converter

Make a converter to structure and unstructure nested objects within a CachedResponse

class requests_cache.serializers.cattrs.CattrStage(factory=None)[source]

Bases: requests_cache.serializers.pipeline.Stage

Base serializer class that does pre/post-processing with cattrs. This can be used either on its own, or as a stage within a SerializerPipeline.

Parameters

factory (Optional[Callable[…, GenConverter]]) –

dumps(value)[source]
Parameters

value (CachedResponse) –

Return type

Dict

loads(value)[source]
Parameters

value (Dict) –

Return type

CachedResponse

requests_cache.serializers.cattrs.init_converter(factory=None)[source]

Make a converter to structure and unstructure nested objects within a CachedResponse

Parameters

factory (Optional[Callable[…, GenConverter]]) –