This document is for Kombu's development version, which can be significantly different from previous releases. Get the stable docs here: 4.1.
Message Serialization - kombu
¶
Serialization utilities.
Overview¶
Centralized support for encoding/decoding of data structures. Contains json, pickle, msgpack, and yaml serializers.
Optionally installs support for YAML if the PyYAML package is installed.
Optionally installs support for msgpack if the msgpack-python package is installed.
Registry¶
-
kombu.serialization.
register
(name, encoder, decoder, content_type, content_encoding=u'utf-8')¶ Register a new encoder/decoder.
Parameters: - name (str) – A convenience name for the serialization method.
- encoder (callable) – A method that will be passed a python data
structure and should return a string representing the
serialized data. If
None
, then only a decoder will be registered. Encoding will not be possible. - decoder (Callable) – A method that will be passed a string
representing serialized data and should return a python
data structure. If
None
, then only an encoder will be registered. Decoding will not be possible. - content_type (str) – The mime-type describing the serialized structure.
- content_encoding (str) – The content encoding (character set) that the decoder method will be returning. Will usually be utf-8, us-ascii, or binary.
-
kombu.serialization.
registry
= <kombu.serialization.SerializerRegistry object>¶ Global registry of serializers/deserializers.