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

Own and manage the raw HTTP request body stream.

Enforce the max-body-size limit and provide transparent replay when the body has already been buffered by read().

Notes

The underlying transport stream is consumed at most once. After read() completes, stream() replays the cached buffer so callers such as the multipart parser keep working even after a plain body() call. Calling stream() after a streaming consumer has iterated it—without a prior read()—raises RuntimeError. Raw bytes are gone after streaming multipart.

Method __init__ Initialize a BodyStream for the given transport interface.
Async Method read Buffer and return the full request body. Idempotent.
Async Method stream Yield body chunks from the transport.
Class Variable __slots__ Undocumented
Instance Variable __body Undocumented
Instance Variable __consumed Undocumented
Instance Variable __is_rsgi Undocumented
Instance Variable __max_buffer_size Undocumented
Instance Variable __max_size Undocumented
Instance Variable __receive Undocumented
Property isBuffered Return True when the full body has been cached by read().
Property isConsumed Return True when the raw transport stream has been consumed.
def __init__(self, interface: Interface, receive_or_protocol: object, max_body_size: int | None = HTTPBodyLimits.max_body_size, *, max_buffer_size: int | None = HTTPBodyLimits.max_buffer_size): (source)

Initialize a BodyStream for the given transport interface.

Parameters
interface:InterfaceTransport protocol type (ASGI or RSGI).
receive_or_protocol:objectASGI receive callable or RSGI HTTPProtocol instance.
max_body_size:int | None, optionalMaximum allowed body size in bytes (default 16 MiB). An explicit None disables the transport limit for a manually built stream.
max_buffer_size:int | None, optionalMaximum bytes buffered by read() (default 2 MiB). An explicit None disables this limit for a manually built stream.
Returns
NoneUndocumented
async def read(self) -> bytes: (source)

Buffer and return the full request body. Idempotent.

Subsequent calls return the cached buffer without re-reading the transport.

Returns
bytesComplete request body as a contiguous bytes object.
Raises
RuntimeErrorIf the stream was consumed by a streaming consumer without having been buffered first.
PayloadTooLargeExceptionIf the body exceeds max_body_size or max_buffer_size.
async def stream(self) -> AsyncGenerator[bytes]: (source)

Yield body chunks from the transport.

Replay the internal buffer as a single chunk when read() was called first, making this method safe to call multiple times.

Yields
bytesA chunk of the raw request body.
Raises
RuntimeErrorIf the stream was consumed by a streaming consumer (e.g. multipart) before the body was buffered.
PayloadTooLargeExceptionIf incoming data exceeds max_body_size.

Undocumented

__consumed: bool = (source)

Undocumented

__is_rsgi: bool = (source)

Undocumented

__max_buffer_size = (source)

Undocumented

__max_size = (source)

Undocumented

__receive = (source)

Undocumented

Return True when the full body has been cached by read().

Returns
boolTrue if the body has been fully buffered, False otherwise.

Return True when the raw transport stream has been consumed.

Returns
boolTrue if the transport stream has been iterated, False otherwise.