libearth.codecs — Common codecs¶
This module provides commonly used codecs to parse RSS-related standard formats.
-
class
libearth.codecs.Boolean(true='true', false='false', default_value=None)¶ Codec to interpret boolean representation in strings e.g.
'true','no', and encodeboolvalues back to string.Parameters:
-
class
libearth.codecs.Enum(values)¶ Codec that accepts only predefined fixed types of values:
gender = Enum(['male', 'female'])
Actually it doesn’t any encoding nor decoding, but it simply validates all values from XML and Python both.
Note that values have to consist of only strings.
Parameters: values ( collections.Iterable) – any iterable that yields all possible values
-
class
libearth.codecs.Integer¶ Codec to encode and decode integer numbers.
-
class
libearth.codecs.Rfc3339(prefer_utc=False)¶ Codec to store
datetime.datetimevalues to RFC 3339 format.Parameters: prefer_utc ( bool) – normalize all timezones to UTC.Falseby default
-
class
libearth.codecs.Rfc822(microseconds=False)¶ Codec to encode/decode
datetime.datetimevalues to/from RFC 822 format.Parameters: microseconds ( bool) – whether to preserve and parse microseconds as well.Falseby default since it’s not standard compliantNew in version 0.3.0: Added
microsecondsoption.