aistore.sdk.batch.multipart.multipart_decoder
aistore.sdk.batch.multipart.multipart_decoder
Module Contents
Classes
Data
API
A multipart decoder for parsing multipart HTTP responses.
Handles boundary extraction, content parsing, and data extraction from individual parts. The decoder supports both Windows (\r\n) and Unix (\n) line endings and gracefully handles malformed content by skipping invalid parts.
Parameters:
Character encoding to use. Defaults to “utf-8”.
If True, yields part body content as an iterator of chunks that can be directly read from. If False, yields entire content in memory as bytes. Defaults to False. Note that this functionality is in development, not fully tested, and subject to change.
Size of chunks when streaming. Defaults to 8192.
Maximum buffer size for sliding window. Defaults to 64KB.
Parse multipart content and extract data from each body part (non-streaming).
Parameters:
Boundary identifier used to separate body parts
Raw multipart content to parse
Returns: Iterator[Tuple[bytes, bytes]]
Iterator[Tuple[bytes, bytes]]: Iterator over extracted body part header and data
Use a streaming parser to start decoding incoming multipart stream. Only extracts headers in memory and streams the body content per part.
Parse individual multipart body part and extract headers and body.
Parameters:
Raw body part content including headers and body
Returns: Optional[Tuple[bytes, bytes]]
Optional[Tuple[bytes, bytes]]: Extracted headers and body, or None if parsing fails
Decode contents of a multipart HTTP response.
Parameters:
HTTP response object containing multipart data