Parsers
Django Rest Framework YAML parser.
- class smarter.lib.drf.parsers.YAMLParser[source]
Bases:
BaseParserA custom parser for YAML request payloads.
- media_type = 'application/x-yaml'
- parse(stream, media_type=None, parser_context=None)[source]
Parse a UTF-8 YAML request body.
The body itself is never logged: a manifest, such as a Secret’s, can hold credentials.
- Parameters:
stream – The request body stream.
media_type – The request’s media type, unused.
parser_context – DRF’s parser context, unused.
- Returns:
The parsed data.
- Raises:
ParseError – If the body is not UTF-8, or not valid YAML.
- smarter.lib.drf.parsers.YAML_LOADER
PyYAML’s C safe loader when PyYAML was built with libyaml, which is much faster, else the pure Python one.