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

class RSGIResponseAdapter(ResponseAdapter): (source)

View In Hierarchy

Undocumented

Method __ensureContentLength Add content-length to headers if absent, reflecting the body size.
Method __sendFile Send a file or the byte interval selected by the request.
Async Method __sendHead Send HEAD metadata without starting an event producer.
Async Method __sendResponseStream Deliver an ordinary stream or observe disconnects for an event stream.
Async Method __sendStream Send and close a stream through the existing RSGI transport.
Async Method __waitDisconnect Await Granian's supported HTTP client disconnect notification.
Async Method send Send the HTTP response using the appropriate protocol adapter.
Class Variable __slots__ Undocumented
def __ensureContentLength(self, headers: list[tuple[str, str]], response: Response): (source)

Add content-length to headers if absent, reflecting the body size.

Parameters
headers:list of tuple of strMutable headers list to append content-length into.
response:ResponseResponse object used to compute the expected body size.
Returns
NoneHeaders list is mutated in place; no value is returned.
def __sendFile(self, adapter: TransportAdapter, response: FileResponse, protocol: HTTPProtocol, status: int, headers: list[tuple[str, str]]): (source)

Send a file or the byte interval selected by the request.

Parameters
adapter:TransportAdapterRequest headers used to select the file range.
response:FileResponseFile metadata and source path.
protocol:HTTPProtocolRSGI response writer.
status:intHTTP status for a complete file.
headers:list[tuple[str, str]]Response headers for this request.
Returns
NoneThe file response is handed to the protocol.
async def __sendHead(self, response: Response, protocol: HTTPProtocol, status: int, headers: list[tuple[str, str]]): (source)

Send HEAD metadata without starting an event producer.

Parameters
response:ResponseResponse whose metadata is sent.
protocol:HTTPProtocolRSGI response writer.
status:intResponse status code.
headers:list[tuple[str, str]]Response headers.
Returns
NoneClose an unstarted event stream after sending the empty response.
async def __sendResponseStream(self, response: Response, protocol: HTTPProtocol, status: int, headers: list[tuple[str, str]]) -> bool: (source)

Deliver an ordinary stream or observe disconnects for an event stream.

Parameters
response:ResponseResponse owning the selected stream.
protocol:HTTPProtocolRSGI response writer and disconnect notifier.
status:intResponse status code.
headers:list[tuple[str, str]]Serialized response headers.
Returns
boolWhether delivery and cleanup completed before a client disconnect.
async def __sendStream(self, iterator: AsyncIterator[bytes], protocol: HTTPProtocol, status: int, headers: list[tuple[str, str]]): (source)

Send and close a stream through the existing RSGI transport.

Parameters
iterator:AsyncIterator[bytes]Owned iterator, closed even when stream creation fails.
protocol:HTTPProtocolRSGI response protocol.
status:intResponse status code.
headers:list[tuple[str, str]]Response headers.
Returns
NoneReturn after all bytes have been sent and cleanup succeeds.
async def __waitDisconnect(self, protocol: HTTPProtocol): (source)

Await Granian's supported HTTP client disconnect notification.

Parameters
protocol:HTTPProtocolRSGI protocol exposing client_disconnect().
Returns
NoneReturn when the client connection closes.
async def send(self, adapter: TransportAdapter, response: Response, protocol: HTTPProtocol): (source)

Send the HTTP response using the appropriate protocol adapter.

Parameters
adapter:TransportAdapterTransport adapter containing request information.
response:ResponseResponse object to be sent back to the client.
protocol:HTTPProtocolProtocol instance used to send the response.
Returns
NoneSends the response via protocol and returns nothing.
Raises
BaseExceptionPropagate metadata or delivery failures after closing an owned SSE source.