Payload
Resources to handle manipulation of payload data returned by responses into Python objects.
Classes:
Handles payload data conversion to return response payload in expected format. |
|
|
|
|
- class aiorequestful.response.payload.PayloadHandler
Bases:
ABC,GenericHandles payload data conversion to return response payload in expected format.
Methods:
serialize(payload)Serialize the payload object to a string.
deserialize(response)Extract payload data from the given
responseand serialize to the appropriate object.- abstractmethod async serialize(payload)
Serialize the payload object to a string.
- Return type:
str
- abstractmethod async deserialize(response)
Extract payload data from the given
responseand serialize to the appropriate object.- Parameters:
response (
Union[str,bytes,bytearray,ClientResponse,TypeVar(T, bound=Any)]) – The response/payload to handle.- Raises:
PayloadHandlerError – When the input data is not recognised.
- Return type:
TypeVar(T, bound=Any)
- class aiorequestful.response.payload.StringPayloadHandler
Bases:
PayloadHandler[str]Methods:
serialize(payload)Serialize the payload object to a string.
deserialize(response)Extract payload data from the given
responseand serialize to the appropriate object.- async serialize(payload)
Serialize the payload object to a string.
- Return type:
str
- async deserialize(response)
Extract payload data from the given
responseand serialize to the appropriate object.- Parameters:
response (
str|bytes|bytearray|ClientResponse) – The response/payload to handle.- Raises:
PayloadHandlerError – When the input data is not recognised.
- Return type:
str
- class aiorequestful.response.payload.BytesPayloadHandler(encoding='utf-8')
Bases:
PayloadHandler[bytes]Attributes:
Methods:
serialize(payload)Serialize the payload object to a string.
deserialize(response)Extract payload data from the given
responseand serialize to the appropriate object.- encoding
- async serialize(payload)
Serialize the payload object to a string.
- Return type:
str
- async deserialize(response)
Extract payload data from the given
responseand serialize to the appropriate object.- Parameters:
response (
str|bytes|bytearray|ClientResponse) – The response/payload to handle.- Raises:
PayloadHandlerError – When the input data is not recognised.
- Return type:
bytes
- class aiorequestful.response.payload.JSONPayloadHandler(indent=None)
Bases:
PayloadHandler[dict[str,str|int|float|list|dict|bool|None]]Attributes:
Methods:
serialize(payload)Serialize the payload object to a string.
deserialize(response)Extract payload data from the given
responseand serialize to the appropriate object.- indent
- async serialize(payload)
Serialize the payload object to a string.
- Return type:
str
- async deserialize(response)
Extract payload data from the given
responseand serialize to the appropriate object.- Parameters:
response (
str|bytes|bytearray|ClientResponse|dict[str,str|int|float|list|dict|bool|None]) – The response/payload to handle.- Raises:
PayloadHandlerError – When the input data is not recognised.
- Return type:
dict[str,str|int|float|list|dict|bool|None]