ORIONIS API REFERENCE

THE ORIONIS API

Build with clarity.

Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.

class documentation

Parse a multipart byte stream into form fields and uploaded files.

Method __init__ Initialize a new MultipartStreamParser instance.
Async Method _advanceState Advance the parser according to the current state.
Async Method _consumeBody Consume a body segment and advance the parser to the next state.
Method _delimiterEnd Resolve the end of a multipart delimiter line.
Method _discardPrefix Discard consumed bytes and realign the delimiter padding cursor.
Method _findBoundary Find a complete multipart delimiter or an incomplete suffix.
Async Method _finishPart Finalize a part body or decode transfer-encoded file content.
Method _newPart Create a multipart part from the parsed MIME headers.
Async Method _parseParts Parse all parts until the multipart stream ends or fails.
Method _readHeaders Read a complete MIME header block for the next multipart part.
Async Method _receiveChunk Read the next chunk from the stream and track end-of-stream.
Method _searchBoundary Search for the next multipart boundary and decide the parser state.
Async Method _writePart Write a buffer prefix into the active part and enforce size limits.
Async Method parse Parse the multipart stream and return the collected form data.
Class Variable __slots__ Undocumented
Instance Variable _atStart Undocumented
Instance Variable _currentPart Undocumented
Instance Variable _eof Undocumented
Instance Variable _headerSearch Undocumented
Instance Variable _memorySize Undocumented
Instance Variable _paddingEnd Undocumented
Instance Variable _paddingStart Undocumented
Instance Variable _partMemorySize Undocumented
Instance Variable _pendingChunk Undocumented
Instance Variable _pendingOffset Undocumented
Instance Variable _totalSize Undocumented
Instance Variable boundary Undocumented
Instance Variable buffer Undocumented
Instance Variable current_part_size Undocumented
Instance Variable fields_count Undocumented
Instance Variable files_count Undocumented
Instance Variable max_body_size Undocumented
Instance Variable max_field_size Undocumented
Instance Variable max_fields Undocumented
Instance Variable max_files Undocumented
Instance Variable max_header_size Undocumented
Instance Variable max_memory_size Undocumented
Instance Variable max_part_size Undocumented
Instance Variable memory_threshold Undocumented
Instance Variable stream Undocumented
def __init__(self, stream: AsyncIterable[bytes], boundary: bytes, *, max_files: int = HTTPBodyLimits.max_files, max_fields: int = HTTPBodyLimits.max_fields, max_part_size: int = HTTPBodyLimits.max_part_size, memory_threshold: int = HTTPBodyLimits.memory_threshold, max_header_size: int = HTTPBodyLimits.max_header_size, max_body_size: int = HTTPBodyLimits.max_body_size, max_field_size: int = HTTPBodyLimits.max_field_size, max_memory_size: int = HTTPBodyLimits.max_memory_size): (source)

Initialize a new MultipartStreamParser instance.

Parameters
stream:AsyncIterable[bytes]Async byte stream produced by the transport layer.
boundary:bytesRaw multipart boundary token (without leading --).
max_files:int, optionalMaximum number of file parts accepted (default 32).
max_fields:int, optionalMaximum number of field parts accepted (default 128).
max_part_size:int, optionalMaximum byte size of a single part (default 10 MiB).
memory_threshold:int, optionalBytes before a file part spills to disk (default 256 KiB).
max_header_size:int, optionalMaximum byte size of the MIME headers for each part (default 16 KiB).
max_body_size:int, optionalMaximum transport bytes, including preamble and epilogue (16 MiB).
max_field_size:int, optionalMaximum raw bytes of a single text field (default 1 MiB).
max_memory_size:int, optionalRetained field/file memory budget (default 8 MiB), excluding transport buffers, object metadata and temporary copies.
Returns
NoneUndocumented
async def _advanceState(self, state: int, current_part: MultipartPart | None, form_items: list[tuple[str, object]], body_marker: bytes, tail_size: int) -> tuple[int, MultipartPart | None, bool]: (source)

Advance the parser according to the current state.

Parameters
state:intCurrent parser state.
current_part:MultipartPart | NoneCurrent part being streamed.
form_items:list[tuple[str, object]]Accumulated form values collected so far.
body_marker:bytesBoundary marker used to detect body terminations.
tail_size:intMinimum trailing bytes required to recognize an incomplete boundary.
Returns
tuple[int, MultipartPart | None, bool]Next state, part pointer, and whether the loop should continue.
async def _consumeBody(self, current_part: MultipartPart, form_items: list[tuple[str, object]], body_marker: bytes, tail_size: int) -> tuple[int, MultipartPart | None]: (source)

Consume a body segment and advance the parser to the next state.

Parameters
current_part:MultipartPartPart being read from the incoming multipart stream.
form_items:list[tuple[str, object]]Accumulated form values collected so far.
body_marker:bytesBoundary marker used to detect the end of a body section.
tail_size:intMinimum trailing bytes required to recognize an incomplete boundary.
Returns
tuple[int, MultipartPart | None]Parser state and the current part after processing the segment.
def _delimiterEnd(self, start: int) -> int: (source)

Resolve the end of a multipart delimiter line.

Parameters
start:intOffset where the boundary candidate begins.
Returns
intEnd offset for a complete delimiter, -1 for an incomplete one, or -2 for an invalid boundary.
def _discardPrefix(self, length: int): (source)

Discard consumed bytes and realign the delimiter padding cursor.

Parameters
length:intNumber of leading bytes to remove from the buffer.
Returns
NoneComplete the documented operation without returning a value.
def _findBoundary(self, marker: bytes) -> tuple[int, int]: (source)

Find a complete multipart delimiter or an incomplete suffix.

Parameters
marker:bytesBoundary sequence to search for in the active buffer.
Returns
tuple[int, int]Pair containing the delimiter start offset and its end offset.
async def _finishPart(self, part: MultipartPart) -> object: (source)

Finalize a part body or decode transfer-encoded file content.

Parameters
part:MultipartPartPart whose content should be finalized.
Returns
objectFinalized value for the form field or uploaded file.
def _newPart(self, header_end: int) -> MultipartPart: (source)

Create a multipart part from the parsed MIME headers.

Parameters
header_end:intOffset where the header block ends within the buffer.
Returns
MultipartPartInitialized multipart part with its metadata and body buffer.
async def _parseParts(self, form_items: list[tuple[str, object]]) -> FormData: (source)

Parse all parts until the multipart stream ends or fails.

Parameters
form_items:list[tuple[str, object]]Accumulated form values collected so far.
Returns
FormDataParsed form data container for all field and file parts.
def _readHeaders(self) -> MultipartPart | None: (source)

Read a complete MIME header block for the next multipart part.

Returns
MultipartPart | NoneThe initialized part when headers are complete, otherwise None.
async def _receiveChunk(self, stream: AsyncIterator[bytes]) -> bool: (source)

Read the next chunk from the stream and track end-of-stream.

Parameters
stream:AsyncIterator[bytes]Async byte stream providing incoming chunks.
Returns
boolTrue when more data is available, otherwise False.
def _searchBoundary(self, body_marker: bytes) -> int: (source)

Search for the next multipart boundary and decide the parser state.

Parameters
body_marker:bytesDelimiter sequence used to terminate a body segment.
Returns
intNext parser state to run.
async def _writePart(self, part: MultipartPart, length: int): (source)

Write a buffer prefix into the active part and enforce size limits.

Parameters
part:MultipartPartCurrent multipart part being populated.
length:intNumber of bytes to append from the current buffer.
Returns
NoneComplete the documented operation without returning a value.
async def parse(self) -> FormData: (source)

Parse the multipart stream and return the collected form data.

Returns
FormDataContainer with all parsed field values and uploaded files.
_atStart: bool = (source)

Undocumented

Undocumented

Undocumented

_headerSearch = (source)

Undocumented

_memorySize = (source)

Undocumented

_paddingEnd = (source)

Undocumented

_paddingStart = (source)

Undocumented

_partMemorySize: int = (source)

Undocumented

_pendingChunk = (source)

Undocumented

_pendingOffset = (source)

Undocumented

_totalSize: int = (source)

Undocumented

boundary = (source)

Undocumented

Undocumented

current_part_size: int = (source)

Undocumented

fields_count: int = (source)

Undocumented

files_count: int = (source)

Undocumented

max_body_size = (source)

Undocumented

max_field_size = (source)

Undocumented

max_fields = (source)

Undocumented

max_files = (source)

Undocumented

max_header_size = (source)

Undocumented

max_memory_size = (source)

Undocumented

max_part_size = (source)

Undocumented

memory_threshold = (source)

Undocumented

Undocumented