Multipart reference¶
- class aiohttp.MultipartResponseWrapper(resp, stream)¶
Wrapper around the
MultipartReaderto take care about underlying connection and close it when it needs in.- async next()¶
Emits next multipart reader object.
- async release()¶
Releases the connection gracefully, reading all the content to the void.
- class aiohttp.BodyPartReader(boundary, headers, content)[source]¶
Multipart reader for single body part.
- async json(*, encoding=None)[source]¶
Like
read(), but assumes that body parts contains JSON data.- Parameters:
encoding (str) – Custom JSON encoding. Overrides specified in charset param of
Content-Typeheader
- async form(*, encoding=None)[source]¶
Like
read(), but assumes that body parts contains form urlencoded data.- Parameters:
encoding (str) – Custom form encoding. Overrides specified in charset param of
Content-Typeheader
- decode(data)[source]¶
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:
- class aiohttp.MultipartReader(headers, content)[source]¶
Multipart body reader.
- classmethod from_response(cls, response)[source]¶
Constructs reader instance from HTTP response.
- Parameters:
response –
ClientResponseinstance