Preconf

The cattrs library includes a number of pre-configured converters that perform some pre-serialization steps required for specific serialization formats.

This module wraps those converters as serializer Stage objects. These are then used as a stage in a SerializerPipeline, which runs after the base converter and before the format’s dumps() (or equivalent) method.

For any optional libraries that aren’t installed, the corresponding serializer will be a placeholder class that raises an ImportError at initialization time instead of at import time.

base_stage

Base stage for all serializer pipelines (or standalone dict serializer)

bson_preconf_stage

Pre-serialization steps for BSON

bson_serializer

Complete BSON serializer; using pymongo's bson.json_util if installed, otherwise standalone bson codec

dict_serializer

Partial serializer that unstructures responses into dicts

json_preconf_stage

Pre-serialization steps for JSON

json_serializer

Complete JSON serializer; uses ultrajson if available

msgpack_preconf_stage

Pre-serialization steps for msgpack

orjson_preconf_stage

Pre-serialization steps for orjson

pickle_serializer

Complete pickle serializer

safe_pickle_serializer

Create a serializer that uses pickle + itsdangerous to add a signature to responses on write, and validate that signature with a secret key on read.

signer_stage

Create a stage that uses itsdangerous to add a signature to responses on write, and validate that signature with a secret key on read.

toml_preconf_stage

Pre-serialization steps for TOML

ujson_preconf_stage

Pre-serialization steps for ultrajson

utf8_encoder

Encode to bytes

yaml_preconf_stage

Pre-serialization steps for YAML

yaml_serializer

Complete YAML serializer

requests_cache.serializers.preconf.base_stage = <requests_cache.serializers.cattrs.CattrStage object>

Base stage for all serializer pipelines (or standalone dict serializer)

requests_cache.serializers.preconf.bson_preconf_stage = <requests_cache.serializers.cattrs.CattrStage object>

Pre-serialization steps for BSON

requests_cache.serializers.preconf.bson_serializer = <requests_cache.serializers.pipeline.SerializerPipeline object>

Complete BSON serializer; using pymongo’s bson.json_util if installed, otherwise standalone bson codec

requests_cache.serializers.preconf.dict_serializer = <requests_cache.serializers.cattrs.CattrStage object>

Partial serializer that unstructures responses into dicts

requests_cache.serializers.preconf.json_preconf_stage = <requests_cache.serializers.cattrs.CattrStage object>

Pre-serialization steps for JSON

requests_cache.serializers.preconf.json_serializer = <requests_cache.serializers.pipeline.SerializerPipeline object>

Complete JSON serializer; uses ultrajson if available

requests_cache.serializers.preconf.msgpack_preconf_stage = <requests_cache.serializers.cattrs.CattrStage object>

Pre-serialization steps for msgpack

requests_cache.serializers.preconf.orjson_preconf_stage = <requests_cache.serializers.cattrs.CattrStage object>

Pre-serialization steps for orjson

requests_cache.serializers.preconf.pickle_serializer = <requests_cache.serializers.pipeline.SerializerPipeline object>

Complete pickle serializer

requests_cache.serializers.preconf.safe_pickle_serializer(secret_key=None, salt='requests-cache', **kwargs)[source]

Create a serializer that uses pickle + itsdangerous to add a signature to responses on write, and validate that signature with a secret key on read.

Return type

SerializerPipeline

requests_cache.serializers.preconf.signer_stage(secret_key=None, salt='requests-cache')[source]

Create a stage that uses itsdangerous to add a signature to responses on write, and validate that signature with a secret key on read. Can be used in a SerializerPipeline in combination with any other serialization steps.

Return type

Stage

requests_cache.serializers.preconf.toml_preconf_stage = <requests_cache.serializers.cattrs.CattrStage object>

Pre-serialization steps for TOML

requests_cache.serializers.preconf.ujson_preconf_stage = <requests_cache.serializers.cattrs.CattrStage object>

Pre-serialization steps for ultrajson

requests_cache.serializers.preconf.utf8_encoder = <requests_cache.serializers.pipeline.Stage object>

Encode to bytes

requests_cache.serializers.preconf.yaml_preconf_stage = <requests_cache.serializers.cattrs.CattrStage object>

Pre-serialization steps for YAML

requests_cache.serializers.preconf.yaml_serializer = <requests_cache.serializers.pipeline.SerializerPipeline object>

Complete YAML serializer