CBOR Serializer
cbor-based network packet serializer module.
The CBOR is an alternative representation of the JSON data models.
See also
- Optional Dependencies
Explains how to install
cborextra.
- class easynetwork.serializers.cbor.CBORSerializer
Bases:
FileBasedPacketSerializer[Any,Any]A serializer built on top of the
cbor2module.Needs
cborextra dependencies.- __init__(encoder_config: CBOREncoderConfig | None = None, decoder_config: CBORDecoderConfig | None = None, *, limit: int = DEFAULT_SERIALIZER_LIMIT, debug: bool = False) None
- Parameters:
encoder_config (CBOREncoderConfig | None) – Parameter object to configure the
CBOREncoder.decoder_config (CBORDecoderConfig | None) – Parameter object to configure the
CBORDecoder.limit (int) – Maximum buffer size. Used in incremental serialization context.
debug (bool) – If
True, add information toDeserializeErrorvia theerror_infoattribute.
Configuration
- class easynetwork.serializers.cbor.CBOREncoderConfig
Bases:
objectA dataclass with the CBOR encoder options.
See
cbor2.CBOREncoderfor details.- timezone: datetime.tzinfo | None = None
- class easynetwork.serializers.cbor.CBORDecoderConfig
Bases:
objectA dataclass with the CBOR decoder options.
See
cbor2.CBORDecoderfor details.