Multipart reference¶
- class aiohttp.MultipartResponseWrapper(resp, stream)¶
Wrapper around the
MultipartReaderto take care about underlying connection and close it when it needs in.
- class aiohttp.BodyPartReader(boundary, headers, content)¶
Multipart reader for single body part.
- decode(data)¶
Decodes data according the specified
Content-EncodingorContent-Transfer-Encodingheaders value.Supports
gzip,deflateandidentityencodings forContent-Encodingheader.Supports
base64,quoted-printable,binaryencodings forContent-Transfer-Encodingheader.- Parameters:
data (bytearray) – Data to decode.
- Raises:
RuntimeError- if encoding is unknown.- Return type:
- get_charset(default=None)¶
Returns charset parameter from
Content-Typeheader or default.
- class aiohttp.MultipartReader(headers, content)¶
Multipart body reader.
- classmethod from_response(cls, response)¶
Constructs reader instance from HTTP response.
- Parameters:
response –
ClientResponseinstance
- class aiohttp.MultipartWriter(subtype='mixed', boundary=None, close_boundary=True)¶
Multipart body writer.
boundarymay be an ASCII-only string.- append(obj, headers=None)¶
Append an object to writer.
- append_payload(payload)¶
Adds a new body part to multipart writer.
- append_json(obj, headers=None)¶
Helper to append JSON part.
- append_form(obj, headers=None)¶
Helper to append form urlencoded part.
- size¶
Size of the payload.