Deserializer Class
Response object model deserializer.
- Inheritance
-
builtins.objectDeserializer
Constructor
Deserializer(classes=None)
Parameters
Variables
- key_extractors
- list
Ordered list of extractors to be used by this deserializer.
Methods
| deserialize_base64 |
Deserialize base64 encoded string into string. |
| deserialize_basic |
Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as valid bool values. |
| deserialize_bytearray |
Deserialize string into bytearray. |
| deserialize_data |
Process data for deserialization according to data type. |
| deserialize_date |
Deserialize ISO-8601 formatted string into Date object. |
| deserialize_decimal |
Deserialize string into Decimal object. |
| deserialize_dict |
Deserialize a dictionary. |
| deserialize_duration |
Deserialize ISO-8601 formatted string into TimeDelta object. |
| deserialize_enum |
Deserialize string into enum object. If the string is not a valid enum value it will be returned as-is and a warning will be logged. |
| deserialize_iso |
Deserialize ISO-8601 formatted string into Datetime object. |
| deserialize_iter |
Deserialize an iterable. |
| deserialize_long |
Deserialize string into long (Py2) or int (Py3). |
| deserialize_object |
Deserialize a generic object. This will be handled as a dictionary. |
| deserialize_rfc |
Deserialize RFC-1123 formatted string into Datetime object. |
| deserialize_time |
Deserialize ISO-8601 formatted string into time object. |
| deserialize_unicode |
Preserve unicode objects in Python 2, otherwise return data as a string. |
| deserialize_unix |
Serialize Datetime object into IntTime format. This is represented as seconds. |
| failsafe_deserialize |
Ignores any errors encountered in deserialization, and falls back to not deserializing the object. Recommended for use in error deserialization, as we want to return the HttpResponseError to users, and not have them deal with a deserialization error. |
deserialize_base64
Deserialize base64 encoded string into string.
static deserialize_base64(attr)
Parameters
Return type
Exceptions
deserialize_basic
Deserialize basic builtin data type from string. Will attempt to convert to str, int, float and bool. This function will also accept '1', '0', 'true' and 'false' as valid bool values.
deserialize_basic(attr, data_type)
Parameters
Return type
Exceptions
deserialize_bytearray
Deserialize string into bytearray.
static deserialize_bytearray(attr)
Parameters
Return type
Exceptions
deserialize_data
Process data for deserialization according to data type.
deserialize_data(data, data_type)
Parameters
Returns
Deserialized object.
Exceptions
deserialize_date
Deserialize ISO-8601 formatted string into Date object.
static deserialize_date(attr)
Parameters
Return type
Exceptions
deserialize_decimal
Deserialize string into Decimal object.
static deserialize_decimal(attr)
Parameters
Return type
Exceptions
deserialize_dict
Deserialize a dictionary.
deserialize_dict(attr, dict_type)
Parameters
- attr
- <xref:<xref:dict/list>>
Dictionary to be deserialized. Also accepts a list of key, value pairs.
Return type
Exceptions
deserialize_duration
Deserialize ISO-8601 formatted string into TimeDelta object.
static deserialize_duration(attr)
Parameters
Return type
Exceptions
deserialize_enum
Deserialize string into enum object.
If the string is not a valid enum value it will be returned as-is and a warning will be logged.
static deserialize_enum(data, enum_obj)
Parameters
- data
- str
Response string to be deserialized. If this value is None or invalid it will be returned as-is.
- enum_obj
- <xref:Enum>
Enum object to deserialize to.
Return type
Exceptions
deserialize_iso
Deserialize ISO-8601 formatted string into Datetime object.
static deserialize_iso(attr)
Parameters
Return type
Exceptions
deserialize_iter
Deserialize an iterable.
deserialize_iter(attr, iter_type)
Parameters
Return type
Exceptions
deserialize_long
Deserialize string into long (Py2) or int (Py3).
static deserialize_long(attr)
Parameters
Return type
Exceptions
deserialize_object
Deserialize a generic object. This will be handled as a dictionary.
deserialize_object(attr, **kwargs)
Parameters
Return type
Exceptions
deserialize_rfc
Deserialize RFC-1123 formatted string into Datetime object.
static deserialize_rfc(attr)
Parameters
Return type
Exceptions
deserialize_time
Deserialize ISO-8601 formatted string into time object.
static deserialize_time(attr)
Parameters
Return type
Exceptions
deserialize_unicode
Preserve unicode objects in Python 2, otherwise return data as a string.
static deserialize_unicode(data)
Parameters
Return type
Exceptions
deserialize_unix
Serialize Datetime object into IntTime format. This is represented as seconds.
static deserialize_unix(attr)
Parameters
Return type
Exceptions
failsafe_deserialize
Ignores any errors encountered in deserialization, and falls back to not deserializing the object. Recommended for use in error deserialization, as we want to return the HttpResponseError to users, and not have them deal with a deserialization error.
failsafe_deserialize(target_obj, data, content_type=None)
Parameters
- data
- <xref:<xref:str/dict>>
The response data to deseralize.
Exceptions
Attributes
basic_types
basic_types = {<class 'str'>: 'str', <class 'int'>: 'int', <class 'bool'>: 'bool', <class 'float'>: 'float'}
valid_date
valid_date = re.compile('\\d{4}[-]\\d{2}[-]\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.?\\d*Z?[-+]?[\\d{2}]?:?[\\d{2}]?')
Feedback
Submit and view feedback for