asphalt.serialization.serializers.yaml

class asphalt.serialization.serializers.yaml.YAMLSerializer(safe=True)

Serializes objects to and from YAML format.

To use this serializer backend, the ruamel.yaml library must be installed. A convenient way to do this is to install asphalt-serialization with the yaml extra:

$ pip install asphalt-serialization[yaml]

Warning

This serializer is insecure in unsafe mode because it allows execution of arbitrary code when deserializing.

Parameters

safe (bool) – True to (de)serialize in safe mode, False to enable extended tags

deserialize(payload)

Deserialize bytes into a Python object.

Return type

Any

property mimetype: str

Return the MIME type for this serialization format.

Return type

str

property safe: bool

Returns True if the safe mode is being used with (de)serialization.

Return type

bool

serialize(obj)

Serialize a Python object into bytes.

Return type

bytes