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

Translate HTTP responses into Granian RSGI operations.

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__ Declare that this class introduces no additional instance slots.
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:orionis.http.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:orionis.http.adapters.request.contracts.transport.TransportAdapterRequest headers used to select the file range.
response:orionis.http.FileResponseFile metadata and source path.
protocol:granian.rsgi.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:orionis.http.ResponseResponse whose metadata is sent.
protocol:granian.rsgi.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:orionis.http.ResponseResponse owning the selected stream.
protocol:granian.rsgi.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:collections.abc.AsyncIterator[bytes]Owned iterator, closed even when stream creation fails.
protocol:granian.rsgi.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:granian.rsgi.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:orionis.http.adapters.request.contracts.transport.TransportAdapterTransport adapter containing request information.
response:orionis.http.ResponseResponse object to be sent back to the client.
protocol:granian.rsgi.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.
__slots__: tuple = (source)

Declare that this class introduces no additional instance slots.