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

Undocumented

Method __init__ Initialize the BaseResponse object.
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 withCookie Attach a cookie and return the response for chaining.
Method withCookies Attach several cookies at once and return the response.
Method withErrors Flash validation errors for the next request.
Method withFlash Flash a status message into the session and return the response.
Method withInput Flash the submitted payload so the next request can repopulate it.
Method withoutCookie Expire a cookie and return the response for chaining.
Class Variable __slots__ Undocumented
Class Variable charset Undocumented
Instance Variable _body Undocumented
Instance Variable _flash Undocumented
Instance Variable _headers Undocumented
Instance Variable _raw_headers Undocumented
Instance Variable _stream Undocumented
Instance Variable background Undocumented
Instance Variable media_type Undocumented
Instance Variable status_code Undocumented
def __init__(self, content: Any = None, status_code: HTTPStatus | int = 200, headers: Mapping[str, str] | None = None, media_type: str | None = None, background: BackgroundTask | None = None): (source)

Initialize the BaseResponse object.

Parameters
content:Any, optionalThe response content or stream.
status_code:HTTPStatus | int, optionalThe HTTP status code for the response.
headers:Mapping[str, str] | None, optionalThe headers to include in the response.
media_type:str | None, optionalThe media type of the response.
background:BackgroundTask | None, optionalThe background task to run after response.
Returns
NoneThis method does not return a value.
def addHeader(self, key: str, value: str): (source)

Add a header to the response.

Parameters
key:strThe header name.
value:strThe header value.
Returns
NoneThis method does not return a value.
def deleteCookie(self, key: str, *, path: str = '/', domain: str | None = None): (source)

Delete a cookie by setting its expiration to the past.

Parameters
key:strThe name of the cookie to delete.
path:str, default "/"The path for which the cookie is valid.
domain:str | None, optionalThe domain for which the cookie is valid.
Returns
NoneThis method does not return a value.
def getBody(self) -> bytes | None: (source)

Return the response body as bytes.

Returns
bytes | NoneThe response body as bytes, or None if not set.
def getFlashData(self) -> dict[str, Any] | None: (source)

Return the data queued by withFlash() for the session flash bag.

Returns
dict[str, Any] | NoneThe queued key-value pairs, or None when nothing was queued.
def getHeader(self, key: str) -> list[str] | None: (source)

Get the values for a header.

Parameters
key:strThe header name.
Returns
list[str] | NoneThe list of header values, or None if not present.
def getMediaType(self) -> str | None: (source)

Return the media type of the response.

Returns
str | NoneThe media type, or None if not set.
def getRawHeaders(self) -> list[tuple[bytes, bytes]]: (source)

Return the headers as a list of (key, value) byte tuples.

Returns
list of tuple of (bytes, bytes)The headers as (key, value) pairs encoded in latin-1.
def getStatusCode(self) -> int: (source)

Return the HTTP status code of the response.

Returns
intThe HTTP status code.
def getStream(self) -> AsyncIterable[bytes] | None: (source)

Return the response stream if present.

Returns
AsyncIterable[bytes] | NoneThe response stream, or None if not set.
def getStringHeaders(self) -> list[tuple[str, str]]: (source)

Return the headers as a list of (key, value) string tuples.

Returns
list of tuple of strThe headers represented as (key, value) string pairs.
def hasHeader(self, key: str) -> bool: (source)

Check if a header is present.

Parameters
key:strThe header name.
Returns
boolTrue if the header is present, False otherwise.
def hasStream(self) -> bool: (source)

Check if the response has a stream.

Returns
boolTrue if a stream is present, False otherwise.
def removeHeader(self, key: str): (source)

Remove a header from the response.

Parameters
key:strThe header name.
Returns
NoneThis method does not return a value.
def render(self, content: Any) -> bytes: (source)

Render the content to bytes.

Parameters
content:AnyThe content to render.
Returns
bytesThe rendered content as bytes.
async def runBackground(self): (source)

Run the background task if it exists.

Returns
NoneThis method does not return a value.
def setCookie(self, key: str, value: str = '', *, max_age: int | None = None, expires: datetime | str | int | None = None, path: str | None = '/', domain: str | None = None, secure: bool = False, http_only: bool = False, same_site: Literal['lax', 'strict', 'none'] | None = 'lax', partitioned: bool = False): (source)

Set a cookie header in the response.

Parameters
key:strThe cookie name.
value:str, optionalThe cookie value. Defaults to an empty string.
max_age:int | None, optionalThe maximum age of the cookie in seconds.
expires:datetime | str | int | None, optionalThe expiration date of the cookie.
path:str | None, optionalThe path for which the cookie is valid.
domain:str | None, optionalThe domain for which the cookie is valid.
secure:bool, optionalWhether the cookie is secure.
http_only:bool, optionalWhether the cookie is HTTP only.
same_site:str | None, optionalThe SameSite policy for the cookie.
partitioned:bool, optionalWhether the cookie is partitioned.
Returns
NoneThis method does not return a value.
def setHeader(self, key: str, value: str): (source)

Set a header, replacing any existing values.

Parameters
key:strThe header name.
value:strThe header value.
Returns
NoneThis method does not return a value.
def withCookie(self, key: str, value: str = '', *, max_age: int | None = None, expires: datetime | str | int | None = None, path: str | None = '/', domain: str | None = None, secure: bool = False, http_only: bool = False, same_site: Literal['lax', 'strict', 'none'] | None = 'lax', partitioned: bool = False) -> Self: (source)

Attach a cookie and return the response for chaining.

Parameters
key:strThe cookie name.
value:str, optionalThe cookie value. Defaults to an empty string.
max_age:int | None, optionalThe maximum age of the cookie in seconds.
expires:datetime | str | int | None, optionalThe expiration date of the cookie.
path:str | None, optionalThe path for which the cookie is valid.
domain:str | None, optionalThe domain for which the cookie is valid.
secure:bool, optionalWhether the cookie is secure.
http_only:bool, optionalWhether the cookie is HTTP only.
same_site:str | None, optionalThe SameSite policy for the cookie.
partitioned:bool, optionalWhether the cookie is partitioned.
Returns
SelfThe same response instance, allowing fluent chaining.
def withCookies(self, cookies: Mapping[str, str | Mapping[str, Any]]) -> Self: (source)

Attach several cookies at once and return the response.

Parameters
cookies:Mapping[str, str | Mapping[str, Any]]Mapping of cookie names to either a plain value or a mapping of keyword arguments accepted by setCookie.
Returns
SelfThe same response instance, allowing fluent chaining.
def withErrors(self, errors: Mapping[str, Any] | Exception) -> Self: (source)

Flash validation errors for the next request.

Errors are read back in templates through the errors global.

Parameters
errors:Mapping[str, Any] | ExceptionMapping of field to message(s), or a validation exception.
Returns
SelfThe same response instance, allowing fluent chaining.
def withFlash(self, key: str, value: Any = None) -> Self: (source)

Flash a status message into the session and return the response.

The value survives for exactly one subsequent request and is read back in templates through the flash() global.

Parameters
key:strFlash data key.
value:Any, optionalValue to flash.
Returns
SelfThe same response instance, allowing fluent chaining.
def withInput(self, values: Mapping[str, Any]) -> Self: (source)

Flash the submitted payload so the next request can repopulate it.

Values are read back in templates through the old() global. Credential-like fields such as password are stripped.

Parameters
values:Mapping[str, Any]Submitted form payload to remember.
Returns
SelfThe same response instance, allowing fluent chaining.
def withoutCookie(self, key: str, *, path: str = '/', domain: str | None = None) -> Self: (source)

Expire a cookie and return the response for chaining.

Parameters
key:strThe name of the cookie to delete.
path:str, default "/"The path for which the cookie is valid.
domain:str | None, optionalThe domain for which the cookie is valid.
Returns
SelfThe same response instance, allowing fluent chaining.
charset: ClassVar[str] = (source)

Undocumented

Undocumented

_flash: dict[str, Any] | None = (source)

Undocumented

_headers: dict[str, str | list[str]] = (source)

Undocumented

_raw_headers: tuple[tuple[bytes, bytes], ...] | None = (source)

Undocumented

_stream: AsyncIterable[bytes] | None = (source)

Undocumented

background = (source)

Undocumented

media_type = (source)

Undocumented

status_code = (source)

Undocumented