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
| Method | accepts |
Check if the client accepts a specific MIME type. |
| Async Method | body |
Return the full request body as bytes. |
| Method | close |
Close request-owned uploaded file handles after response delivery. |
| Method | csrf |
Return the CSRF token for the current request. |
| Async Method | data |
Return a flat, validatable dictionary built from the request body. |
| Async Method | form |
Parse and return multipart form data. |
| Async Method | form |
Parse the request body as URL-encoded form data. |
| Method | is |
Determine if the request was made via AJAX. |
| Async Method | json |
Parse the request body as JSON. |
| Async Method | msgpack |
Decode the request body as MessagePack. |
| Async Method | payload |
Parse and return structured request data based on Content-Type. |
| Async Method | raw |
Return the request body as raw bytes. |
| Method | route |
Return a specific path parameter by key. |
| Method | route |
Return all path parameters as a dictionary. |
| Async Method | stream |
Yield chunks of the request body as they arrive. |
| Async Method | text |
Decode the request body as UTF-8 text. |
| Method | wants |
Determine if the client expects an HTML response based on the Accept header. |
| Method | wants |
Determine if the client prefers a JSON response based on the Accept header. |
| Method | wants |
Determine if the client prefers an XML response based on the Accept header. |
| Async Method | xml |
Parse the request body as XML and return the root element. |
| Class Variable | __slots__ |
Undocumented |
| Class Variable | csrf |
Undocumented |
| Property | accept |
Return the value of the Accept header. |
| Property | api |
Return the API key from the request headers if present. |
| Property | authorization |
Return the Authorization header value if present. |
| Property | base |
Return the base URL for the request. |
| Property | bearer |
Return the bearer token from the Authorization header if present. |
| Property | cookies |
Return parsed cookies from the request. |
| Property | forwarded |
Return the forwarded information from the request scope. |
| Property | headers |
Return the request headers as a Headers object. |
| Property | http |
Return the HTTP version of the request. |
| Property | interface |
Return the interface type of the request (ASGI or RSGI). |
| Property | ip |
Return the client's IP address from the request scope. |
| Property | method |
Return the HTTP request method. |
| Property | path |
Return the request path. |
| Property | port |
Return the client's port number from the request scope. |
| Property | query |
Return parsed query parameters from the request. |
| Property | scheme |
Return the URL scheme (e.g., 'http' or 'https') of the request. |
| Property | scope |
Return the raw ASGI / RSGI connection scope. |
| Property | state |
Return the mutable per-request state namespace. |
| Property | url |
Return the full request URL. |
| Property | user |
Return the User-Agent string from the request headers. |
orionis.http.RequestReturn the full request body as bytes.
Buffers the stream on first call and caches the result. Subsequent calls are O(1) — they return the cached buffer.
| Returns | |
bytes | The complete request body as bytes. |
orionis.http.RequestClose request-owned uploaded file handles after response delivery.
| Returns | |
None | Release parsed multipart resources; repeated calls must be safe. |
orionis.http.RequestReturn the CSRF token for the current request.
The token is set by CSRFTokenMiddleware on every web request before the route handler is invoked. Returns None on API routes where the middleware is not active.
| Returns | |
str | None | The CSRF token string, or None when not available. |
orionis.http.RequestReturn a flat, validatable dictionary built from the request body.
Dispatches by Content-Type:
- application/json → parsed JSON object (must be a mapping)
- application/msgpack → decoded MessagePack object (must be a mapping)
- application/x-www-form-urlencoded → form fields; a key that appears once yields a scalar string, repeated keys yield a list
- multipart/form-data → text fields and uploaded files with the same scalar-or-list collapsing
| Returns | |
dict[str, Any] | Flat dictionary suitable for downstream validation (FormRequest). |
| Raises | |
UnsupportedMediaTypeException | If the Content-Type cannot be converted to a dictionary. |
ValueError | If a JSON or MessagePack body is empty or cannot be decoded, or if multipart parsing fails. |
TypeError | If a decoded JSON or MessagePack body is not a mapping. |
orionis.http.RequestParse and return multipart form data.
| Returns | |
FormData | The parsed multipart form data. |
| Raises | |
UnsupportedMediaTypeException | If the Content-Type is not multipart/form-data. |
ValueError | If the multipart boundary is missing. |
orionis.http.RequestDetermine if the request was made via AJAX.
| Returns | |
bool | True if the X-Requested-With header is 'XMLHttpRequest'. |
orionis.http.RequestParse the request body as JSON.
Validates Content-Type, buffers the body, and delegates decoding to msgspec. Result is cached; a JSON null literal is handled correctly via the __json_parsed sentinel.
| Returns | |
object | The decoded JSON value: dict, list, str, int, float, bool, or None. |
| Raises | |
UnsupportedMediaTypeException | If the Content-Type is not application/json (or a +json subtype). |
ValueError | If the body is empty or not valid JSON. |
orionis.http.RequestDecode the request body as MessagePack.
| Returns | |
object | The decoded MessagePack value, including maps, arrays, scalars, binary data, extension values, or None. |
| Raises | |
msgspec.DecodeError | If the payload is not valid MessagePack. |
orionis.http.RequestParse and return structured request data based on Content-Type.
| Returns | |
Any | Structured data parsed from the request body, or raw bytes if no parser is available. |
orionis.http.RequestReturn the request body as raw bytes.
| Returns | |
bytes | The raw request body. |
orionis.http.RequestYield chunks of the request body as they arrive.
Delegates to BodyStream, which handles RSGI and ASGI transports, enforces max_body_size, and replays from the internal buffer when the body has already been fully read by body() or a parser.
| Returns | |
AsyncGenerator[bytes] | Yields chunks of the request body as bytes. |
orionis.http.RequestDecode the request body as UTF-8 text.
| Returns | |
str | The decoded request body as a string. |
orionis.http.RequestDetermine if the client expects an HTML response based on the Accept header.
| Returns | |
bool | True if the Accept header indicates HTML is expected. |
orionis.http.RequestDetermine if the client prefers a JSON response based on the Accept header.
| Returns | |
bool | True if the Accept header indicates JSON is preferred, otherwise False. |
orionis.http.RequestDetermine if the client prefers an XML response based on the Accept header.
| Returns | |
bool | True if the Accept header indicates XML is preferred. |
orionis.http.RequestParse the request body as XML and return the root element.
Entity declarations are rejected. DTDs without entity declarations are allowed; external resources are not resolved.
| Returns | |
ET.Element | The root element parsed from the XML request body. |
| Raises | |
xml.etree.ElementTree.ParseError | If the XML body is malformed. |
defusedxml.common.EntitiesForbidden | If the document declares an internal or external entity. This is a subclass of defusedxml.common.DefusedXmlException, not ParseError. |
orionis.http.RequestReturn the value of the Accept header.
| Returns | |
str | None | The value of the 'Accept' header, or None if not present. |
orionis.http.RequestReturn the API key from the request headers if present.
| Returns | |
str | None | The API key from the 'X-API-Key' header, or None if not present. |
orionis.http.RequestReturn the Authorization header value if present.
| Returns | |
str | None | The value of the 'Authorization' header, or None if not present. |
orionis.http.RequestReturn the base URL for the request.
| Returns | |
str | The base URL composed of scheme and host. |
orionis.http.RequestReturn the bearer token from the Authorization header if present.
| Returns | |
str | None | The bearer token extracted from the 'Authorization' header, or None if not present or does not start with 'Bearer '. |
orionis.http.RequestReturn parsed cookies from the request.
| Returns | |
Cookies | The parsed cookies as a Cookies object. |
orionis.http.RequestReturn the request headers as a Headers object.
| Returns | |
Headers | The headers associated with the request. |
orionis.http.RequestReturn the HTTP version of the request.
| Returns | |
str | The HTTP version string, such as '1.1' or '2'. |
orionis.http.RequestReturn the interface type of the request (ASGI or RSGI).
| Returns | |
Interface | The interface type of the request. |
orionis.http.RequestReturn the client's IP address from the request scope.
| Returns | |
str | None | The client's IP address if available, otherwise None. |
orionis.http.RequestReturn the HTTP request method.
| Returns | |
str | The HTTP method of the request, such as 'GET' or 'POST'. |
orionis.http.RequestReturn the request path.
| Returns | |
str | The path component of the request URL. |
orionis.http.RequestReturn the client's port number from the request scope.
| Returns | |
int | None | The client's port number if available, otherwise None. |
orionis.http.RequestReturn parsed query parameters from the request.
| Returns | |
QueryParams | The parsed query parameters as a QueryParams object. |
orionis.http.RequestReturn the URL scheme (e.g., 'http' or 'https') of the request.
| Returns | |
str | The URL scheme of the request. |
orionis.http.RequestReturn the raw ASGI / RSGI connection scope.
Exposes the underlying scope dict so that ASGI-aware middleware, tracing libraries, and extensions can read or annotate transport-level data without requiring framework-specific adapters.
| Returns | |
dict[str, Any] | The raw scope dictionary provided by the transport layer. |
orionis.http.RequestReturn the mutable per-request state namespace.
Middleware and handlers can attach arbitrary attributes to this namespace without polluting the scope dict.
| Returns | |
types.SimpleNamespace | The mutable state object for this request. |
orionis.http.RequestReturn the full request URL.
| Returns | |
str | Absolute URL including scheme, host, path, and query string. Result is cached after the first call. |
orionis.http.RequestReturn the User-Agent string from the request headers.
| Returns | |
str | None | The User-Agent string if present, otherwise None. |