aistore.sdk.batch.multipart.stateful_streaming_parser
aistore.sdk.batch.multipart.stateful_streaming_parser
Module Contents
Classes
Data
API
A stateful streaming parser for efficiently processing multipart HTTP responses.
The parser maintains state across multiple parts of a multipart response, automatically detecting boundaries, extracting headers, and providing streaming access to body content.
Parameters:
Iterator yielding chunks of the HTTP response
The multipart boundary marker (including leading dashes)
Maximum size of the internal sliding window buffer
Extract headers using the optimized content reader abstraction.
Returns: Optional[bytes]
Optional[bytes]: Headers as bytes if found, None if stream exhausted
Find the first boundary marker using the optimized buffer reader.
Returns: bool
True if boundary found, False if exhausted without finding boundary
Get the next part without loading it completely into memory.
Returns: Optional[Tuple[bytes, BodyStreamReader]]
Optional[Tuple[bytes, BodyStreamReader]]: If part exists, returns tuple of headers and body stream