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

Serve a filesystem resource through an HTTP response.

Method __init__ Initialize a file streaming response.
Async Method _fileIterator Yield file content in chunks asynchronously.
Method getFileSize Return the file size in bytes.
Method getPath Return the file path.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _chunk_size Size of file chunks to read and send.
Instance Variable _file_size Advertise the file size recorded during validation.
Instance Variable _path Path to the file to serve.

Inherited from StreamingResponse:

Method _wrapSyncIterable Adapt a synchronous iterable of bytes to an asynchronous iterable.
Instance Variable _body HTTP response body or encoded payload returned to the client.

Inherited from Response (via StreamingResponse):

Method addHeader Add a header to the response.
Method deleteCookie Delete a cookie by setting its expiration to the past.
Method getBody Return the response body as bytes.
Method getFlashData Return the data queued by withFlash() for the session flash bag.
Method getHeader Get the values for a header.
Method getMediaType Return the media type of the response.
Method getRawHeaders Return the headers as a list of (key, value) byte tuples.
Method getStatusCode Return the HTTP status code of the response.
Method getStream Return the response stream if present.
Method getStringHeaders Return the headers as a list of (key, value) string tuples.
Method hasHeader Check if a header is present.
Method hasStream Check if the response has a stream.
Method removeHeader Remove a header from the response.
Method render Render the content to bytes.
Async Method runBackground Run the background task if it exists.
Method setCookie Set a cookie header in the response.
Method setHeader Set a header, replacing any existing values.
Method withBackground Set the background task and return the response.
Method withCookie Attach a cookie and return the response for chaining.
Method withCookies Attach several cookies at once and return the response.
Method withHeaders Merge response headers and return the response.
Method withoutCookie Expire a cookie and return the response for chaining.
Method withStatusCode Set the HTTP status code and return the response.
Class Variable charset Encode text responses using UTF-8.
Instance Variable _flash Initialize flash data when it is first queued.
Instance Variable _headers The headers to include in the response.
Instance Variable _raw_headers Protocol-ready header pairs emitted with the response.
Instance Variable _stream Iterator supplying response body chunks.
Instance Variable background The background task to run after response.
Instance Variable media_type The media type of the response.
Instance Variable status_code The HTTP status code for the response.

Inherited from _FlashData (via StreamingResponse, Response):

Method withErrors Flash validation errors for the next request.
Method withFlash Queue a status message for the owning response or pending view.
Method withInput Flash the submitted payload so the next request can repopulate it.
def __init__(self: Self, path: str | Path, status_code: int = 200, headers: Mapping[str, str] | None = None, media_type: str | None = None, filename: str | None = None, chunk_size: int = 64 * 1024, background: BackgroundTask | None = None): (source)

Initialize a file streaming response.

Parameters
path:str | pathlib.PathPath to the file to serve.
status_code:int, default 200HTTP status code for the response.
headers:collections.abc.Mapping[str, str] | None, optionalOptional response headers.
media_type:str | None, optionalOptional media type for the response.
filename:str | None, optionalOptional filename for Content-Disposition header.
chunk_size:int, default 65536Size of file chunks to read and send.
background:orionis.background.BackgroundTask | None, optionalOptional background task to run after response.
Returns
NoneThis constructor does not return a value.
async def _fileIterator(self: Self) -> AsyncIterable[bytes]: (source)

Yield file content in chunks asynchronously.

Returns
collections.abc.AsyncIterable[bytes]An asynchronous iterable yielding file chunks as bytes.
def getFileSize(self: Self) -> int: (source)

Return the file size in bytes.

Returns
intThe size of the file in bytes.
def getPath(self: Self) -> Path: (source)

Return the file path.

Returns
pathlib.PathThe path to the file being served.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

_chunk_size = (source)

Size of file chunks to read and send.

_file_size = (source)

Advertise the file size recorded during validation.

Path to the file to serve.