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.

module documentation

Undocumented

Function _is_local_reference Accept a local path or an absolute reference with the application origin.
Function _url_origin Extract the normalized scheme, hostname, and effective port of a URL.
Function previous_url Resolve the page a failed submission should be redirected back to.
Async Function validation_response Translate a schema validation failure into an HTTP response.
Constant _DEFAULT_PORTS Undocumented
Constant _DELETE_CODE Undocumented
Constant _FIRST_PRINTABLE_CODE Undocumented
def _is_local_reference(reference: str, base_url: str) -> bool: (source)

Accept a local path or an absolute reference with the application origin.

Parameters
reference:strUntrusted referrer supplied by the client.
base_url:strBase URL of the current application request.
Returns
boolWhether the referrer is suitable for a same-origin redirect.
def _url_origin(url: str) -> tuple[str, str | None, int | None]: (source)

Extract the normalized scheme, hostname, and effective port of a URL.

Parameters
url:strAbsolute URL whose origin is compared with the application origin.
Returns
tuple[str, str | None, int | None]Scheme, lowercase hostname, and explicit or default port.
Raises
ValueErrorIf the authority or port is malformed or contains user credentials.
def previous_url(request: Request) -> str: (source)

Resolve the page a failed submission should be redirected back to.

Resolution order: the last page recorded by the session middleware, the referring URL when it belongs to this application, and finally the URL the form was submitted to.

Parameters
request:RequestIncoming HTTP request.
Returns
strAbsolute URL or path to redirect back to.
async def validation_response(exc: ValidationException, request: Request, responses: IDefaultResponses) -> Response: (source)

Translate a schema validation failure into an HTTP response.

JSON and AJAX clients receive the structured 422 payload, while browsers are redirected back to the submitted form with the errors and the previous input flashed into the session.

Parameters
exc:ValidationExceptionFailure carrying every field error found in the payload.
request:RequestIncoming HTTP request.
responses:IDefaultResponsesDefault response factory used to render the error payload.
Returns
ResponseA 422 response, or a 302 redirect back to the previous page.
_DEFAULT_PORTS: dict[str, int] = (source)

Undocumented

Value
{'http': 80, 'https': 443}
_DELETE_CODE: int = (source)

Undocumented

Value
127
_FIRST_PRINTABLE_CODE: int = (source)

Undocumented

Value
32