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 IResponse(ABC): (source)

Known subclasses: orionis.http.Response

View In Hierarchy

Undocumented

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 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
def addHeader(self, key: str, value: str): (source)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

Return the HTTP status code of the response.

Returns
intThe HTTP status code.
overridden in orionis.http.Response

Return the response stream if present.

Returns
AsyncIterable[bytes] | NoneThe response stream, or None if not set.
def hasHeader(self, key: str) -> bool: (source)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

Check if the response has a stream.

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

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)
overridden in orionis.http.Response

Render the content to bytes.

Parameters
content:AnyThe content to render.
Returns
bytesThe rendered content as bytes.
async def runBackground(self): (source)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

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)
overridden in orionis.http.Response

Flash validation errors for the next request.

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)
overridden in orionis.http.Response

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

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)
overridden in orionis.http.Response

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

Parameters
values:Mapping[str, Any]Submitted form payload to remember. Credential-like fields are stripped before storing.
Returns
SelfThe same response instance, allowing fluent chaining.
def withoutCookie(self, key: str, *, path: str = '/', domain: str | None = None) -> Self: (source)
overridden in orionis.http.Response

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.
__slots__: tuple = (source)
overridden in orionis.http.Response

Undocumented