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.
Undocumented
| Async Method | __asgi |
Send ASGI HTTP response through transport adapter. |
| Async Method | __body |
Reject invalid framing and declared oversized bodies before reading. |
| Async Method | __call |
Invoke the registered fallback handler and return its response. |
| Async Method | __call |
Dispatch the request to the pre-resolved route handler. |
| Async Method | __call |
Invoke a preloaded connection handler through the scoped container. |
| Method | __default |
Initialize default HTTP middleware stack. |
| Async Method | __global |
Execute global middleware and serve packaged default-page assets. |
| Async Method | __handle |
Translate a caught exception into an HTTP response. |
| Async Method | __handle |
Dispatch a bounded connection inside a dedicated lifetime scope. |
| Method | __init__ |
Initialize the HTTP kernel with application and failure handler. |
| Async Method | __preload |
Bind one validated policy instance to a static HTTP endpoint. |
| Async Method | __preload |
Import route handlers and prepare their dependency metadata at boot time. |
| Async Method | __preload |
Pre-build middleware instances for all routes at boot time. |
| Async Method | __process |
Build the HTTP response for this request. |
| Async Method | __process |
Validate a handshake and run its connection middleware and handler. |
| Async Method | __request |
Execute route-level middleware for the resolved route. |
| Async Method | __route |
Establish the web or API context before running route middleware. |
| Method | __route |
Initialize route resolver with loaded routes. |
| Async Method | __rsgi |
Send an RSGI HTTP response through the transport adapter. |
| Async Method | __shutdown |
Cancel connection lifetimes within the existing shutdown lifecycle. |
| Method | __websocket |
Check browser origins before allowing an application handshake. |
| Async Method | __web |
Run the route pipeline and translate validation failures for the web. |
| Async Method | boot |
Boot the HTTP kernel by initializing all core components. |
| Method | disconnect |
Expose compiled endpoint opt-ins to the application transport wrapper. |
| Async Method | handle |
Handle an incoming ASGI HTTP request end-to-end. |
| Async Method | handle |
Handle an incoming RSGI HTTP request end-to-end. |
| Class Variable | __slots__ |
Undocumented |
| Instance Variable | __api |
Undocumented |
| Instance Variable | __app |
Undocumented |
| Instance Variable | __asgi |
Undocumented |
| Instance Variable | __body |
Undocumented |
| Instance Variable | __boot |
Undocumented |
| Instance Variable | __catch |
Undocumented |
| Instance Variable | __cls |
Undocumented |
| Instance Variable | __cors |
Undocumented |
| Instance Variable | __default |
Undocumented |
| Instance Variable | __endpoint |
Undocumented |
| Instance Variable | __fallback |
Undocumented |
| Instance Variable | __fn |
Undocumented |
| Instance Variable | __health |
Undocumented |
| Instance Variable | __hub |
Undocumented |
| Instance Variable | __middleware |
Undocumented |
| Instance Variable | __printer |
Undocumented |
| Instance Variable | __proxies |
Undocumented |
| Instance Variable | __rate |
Undocumented |
| Instance Variable | __rate |
Undocumented |
| Instance Variable | __request |
Undocumented |
| Instance Variable | __request |
Undocumented |
| Instance Variable | __routes |
Undocumented |
| Instance Variable | __rsgi |
Undocumented |
| Instance Variable | __security |
Undocumented |
| Instance Variable | __under |
Undocumented |
| Instance Variable | __view |
Undocumented |
| Instance Variable | __web |
Undocumented |
| Instance Variable | __websocket |
Undocumented |
| Instance Variable | __websocket |
Undocumented |
| Instance Variable | __websocket |
Undocumented |
TransportAdapter, response: Response, receive: object, send: object, policy: IHttpEndpointPolicy | None = None):
(source)
¶
Send ASGI HTTP response through transport adapter.
Apply CORS post-processing headers, log request details, and send the response back to the client via ASGI protocol adapter.
| Parameters | |
adapter:TransportAdapter | Transport adapter encapsulating the HTTP request. |
response:Response | HTTP response object to send to client. |
receive:object | ASGI receive callable for reading request body. |
send:object | ASGI send callable for sending response. |
policy:IHttpEndpointPolicy | None | Value supplied for policy. |
| Returns | |
None | Undocumented |
Reject invalid framing and declared oversized bodies before reading.
| Parameters | |
adapter:TransportAdapter | Incoming transport metadata. |
| Returns | |
Response | None | A 400 or 413 response for rejected framing, otherwise None. Stream byte counting remains authoritative when length is absent or false. |
ResolvedRoute, request: Request) -> Response:
(source)
¶
Dispatch the request to the pre-resolved route handler.
Uses boot-time dispatch tables keyed by route object identity, eliminating per-request module imports and attribute lookups.
| Parameters | |
resolvedResolvedRoute | Resolved route descriptor with handler reference and path params. |
request:Request | Request-local parameters, including middleware changes. |
| Returns | |
Response | HTTP response produced by the handler. |
| Raises | |
TypeError | If the handler does not return a Response, dict, or msgspec.Struct. |
ResolvedRoute, socket: WebSocket):
(source)
¶
Invoke a preloaded connection handler through the scoped container.
| Parameters | |
resolvedResolvedRoute | Compiled route with converted parameters. |
socket:WebSocket | Scoped connection injected into application handlers. |
| Returns | |
None | Run the handler for the lifetime of the connection. |
| Raises | |
TypeError | If the handler returns an HTTP response or another value. |
dict, default_responses: IDefaultResponses, *, under_maintenance: bool = False):
(source)
¶
Initialize default HTTP middleware stack.
Configure and instantiate the default middleware chain including proxies, security, CORS, and rate limiting middleware.
| Parameters | |
httpdict | HTTP configuration dictionary with middleware settings. |
defaultIDefaultResponses | Default response handler for middleware rejections. |
underbool | Value supplied for under_maintenance. |
| Returns | |
None | Undocumented |
Execute global middleware and serve packaged default-page assets.
Process request through middleware pipeline: proxies detection, security validation, and CORS negotiation. Framework assets remain available during maintenance and after rate-limit rejections.
| Parameters | |
adapter:TransportAdapter | Transport adapter encapsulating the HTTP request. |
| Returns | |
Response | None | HTTP response if middleware rejects request, None if request passes all middleware checks. |
Exception, request: object, policy: IHttpEndpointPolicy | None = None) -> Response:
(source)
¶
Translate a caught exception into an HTTP response.
| Parameters | |
exc:Exception | The exception raised during request processing. |
request:object | Current request object (may be the raw transport adapter for pre-routing errors). |
policy:IHttpEndpointPolicy | None | Value supplied for policy. |
| Returns | |
Response | Appropriate HTTP response for the given exception type. |
Interface, adapter: TransportAdapter, receive_or_protocol: object, send: object = None):
(source)
¶
Dispatch a bounded connection inside a dedicated lifetime scope.
| Parameters | |
interface:Interface | Server protocol identifier. |
adapter:TransportAdapter | Handshake request metadata. |
receiveobject | ASGI receive callback or Granian WebsocketProtocol. |
send:object, optional | ASGI send callback, omitted for RSGI. |
| Returns | |
None | Await the connection pipeline and always release admission. |
Initialize the HTTP kernel with application and failure handler.
| Parameters | |
app:IApplication | Application instance providing configuration and DI container. |
catch:ICatch | Failure handler used to format unhandled exceptions. |
| Returns | |
None | Undocumented |
type, route: CompiledRoute, policy_instances: dict[ type[ IHttpEndpointPolicy], IHttpEndpointPolicy]):
(source)
¶
Bind one validated policy instance to a static HTTP endpoint.
| Parameters | |
controller:type | Controller declaring an optional HTTP protocol policy. |
route:CompiledRoute | Compiled route associated with the controller. |
policydict[type[IHttpEndpointPolicy], IHttpEndpointPolicy] | Policy instances already constructed during this kernel boot. |
| Returns | |
None | The endpoint uses the shared policy instance for its policy type. |
| Raises | |
TypeError | If a policy is not a policy class or the route is dynamic. |
Import route handlers and prepare their dependency metadata at boot time.
Populates two int-keyed dispatch tables using route object identity, eliminating per-request module imports, attribute lookups, and tuple key construction from the handler invocation hot path. View routes are stored in a third table holding only their template name. Ordinary constructor and action plans are prepared without resolving services or creating controller instances. Custom descriptors remain lazy.
| Returns | |
None | Undocumented |
Pre-build middleware instances for all routes at boot time.
Iterate every compiled route and eagerly resolve each middleware class through the container. Results are stored keyed by the immutable stack tuple so identical stacks share the same instances.
| Returns | |
None | Undocumented |
Interface, adapter: TransportAdapter, receive_or_protocol: object, request_context: object, policy: IHttpEndpointPolicy | None = None) -> Response:
(source)
¶
Build the HTTP response for this request.
Runs global middleware, rate limiting, route resolution, and the handler pipeline. All exceptions are delegated to __handleException.
| Parameters | |
interface:Interface | Transport interface type used to construct the BodyStream. |
adapter:TransportAdapter | Protocol adapter carrying request metadata. |
receiveobject | ASGI receive callable or RSGI HTTPProtocol instance. |
requestobject | Active DI request scope for per-request bindings. |
policy:IHttpEndpointPolicy | None | Value supplied for policy. |
| Returns | |
Response | The fully constructed HTTP response. |
Validate a handshake and run its connection middleware and handler.
| Parameters | |
adapter:TransportAdapter | Handshake metadata for global guards and route matching. |
socket:WebSocket | Connection already bound to the active application scope. |
| Returns | |
None | Reject the handshake or await the application connection lifetime. |
| Raises | |
TypeError | If middleware returns a value instead of None. |
Request, resolved_route: ResolvedRoute) -> Response:
(source)
¶
Execute route-level middleware for the resolved route.
| Parameters | |
request:Request | Incoming HTTP request. |
resolvedResolvedRoute | Resolved route with matched handler and path parameters. |
| Returns | |
Response | HTTP response produced by the pipeline or the handler. |
Request, resolved_route: ResolvedRoute) -> Response:
(source)
¶
Establish the web or API context before running route middleware.
Web routes restore the session, validate CSRF, and resolve the session identity. API routes resolve only the token identity. Both allow guests; access restrictions belong to the application's route middleware.
| Parameters | |
request:Request | Incoming HTTP request. |
resolvedResolvedRoute | Resolved route metadata. |
| Returns | |
Response | HTTP response produced by the middleware pipeline. |
Initialize route resolver with loaded routes.
Build a route resolver instance configured with routes loaded from the provided route loader and cache settings.
| Parameters | |
routeIRouteLoader | Route loader instance to discover and load routes. |
| Returns | |
None | Undocumented |
RSGITransportAdapter, response: Response, protocol: HTTPProtocol, policy: IHttpEndpointPolicy | None = None):
(source)
¶
Send an RSGI HTTP response through the transport adapter.
Apply CORS post-processing headers, log request details, and send the response back to the client via the RSGI protocol adapter.
| Parameters | |
adapter:RSGITransportAdapter | RSGI transport adapter with HTTP scope and client connection. |
response:Response | HTTP response object to send to client. |
protocol:HTTPProtocol | RSGI HTTP protocol version indicator. |
policy:IHttpEndpointPolicy | None | Value supplied for policy. |
| Returns | |
None | Undocumented |
Cancel connection lifetimes within the existing shutdown lifecycle.
| Returns | |
None | Await cooperative cleanup for at most five seconds. |
Check browser origins before allowing an application handshake.
| Parameters | |
adapter:TransportAdapter | Proxy-normalized handshake metadata. |
| Returns | |
bool | True for missing Origin, same origin, or an explicit allowed origin. |
Request, resolved_route: ResolvedRoute) -> Response:
(source)
¶
Run the route pipeline and translate validation failures for the web.
Validation errors are caught here, inside the session middleware, so the resulting redirect still gets its flash bag persisted.
| Parameters | |
request:Request | Incoming HTTP request. |
resolvedResolvedRoute | Resolved route metadata. |
| Returns | |
Response | Handler response, or a redirect back carrying the errors. |
Scope, protocol: HTTPProtocol | WebsocketProtocol) -> object | None:
(source)
¶
Handle an incoming RSGI HTTP request end-to-end.
| Parameters | |
scope:Scope | Granian RSGI scope with connection metadata. |
protocol:HTTPProtocol | RSGI protocol object for writing the response. |
| Returns | |
object | None | Result of sending the RSGI response, or None on error. |