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

Prepare a bounded HTTP request.

The prepared payload owns the headers and bytes submitted to the transport.

Class _JsonBody Write strict JSON directly into a size-limited buffer.
Class _Snapshot Copy only bounded JSON-native containers before handing work to a thread.
Class PreparedRequest Describe one authorized outbound attempt.
Class RequestOptions Describe the options accepted by HTTP terminal methods.
Class Settings Store an immutable snapshot of request-chain settings.
Function _body Resolve the body encoder and its implied media type.
Function _content_type Validate or supply the media type for the chosen encoder.
Function _copy_pairs Copy text pairs while enforcing the unencoded size budget.
Function _escaped_field Percent-encode one query or form field as ASCII.
Function _json_content Encode JSON into a bounded UTF-8 buffer.
Function _urlencoded Serialize ordered field pairs within the byte limit.
Function _validate_query Require explicit query content and a concrete media type for RFC 10008.
Function merge_headers Replace names case-insensitively and enforce the merged wire budget.
Function prepare Snapshot a request with an authorized URL, bounded body and fresh headers.
Function seconds Accept positive and finite time values expressed in seconds.
Function snapshot_options Own mutable arguments before queueing or passing them to a worker.
Function user_headers Validate application-supplied headers and copy their names and values.
Constant _HEADER_NAME Match ASCII token characters permitted in HTTP header names and media types.
Constant _MAX_JSON_DEPTH Limit the nesting depth of a JSON request body.
Constant _MAX_JSON_VALUES Limit the number of JSON values visited in a single request body.
Constant _METHODS Define the HTTP methods accepted by the outgoing request builder.
Constant _PAIR_LENGTH Require exactly two elements in each query or form field pair.
Constant _RESERVED Reserve these header names for the transport and credential binding methods.
Constant _UNBOUND Allow these headers before a chain is bound to an origin.
Constant MAX_HEADER_BYTES Limit the combined size of request headers in bytes, including separators.
Type Alias Headers Keep immutable header name-value pairs in transmission order.
Type Alias Pairs Represent input fields as a mapping or an ordered sequence of key-value pairs.
Type Alias Timeouts Group connect, read, write and pool timeouts in seconds, in that order.
def _body(method: str, options: RequestOptions, settings: Settings) -> tuple[bytes | None, str | None]: (source)

Resolve the body encoder and its implied media type.

Parameters
method:strHTTP method for this attempt.
options:RequestOptionsQuery, headers and body arguments supplied to the terminal.
settings:SettingsImmutable policy of the selected request chain.
Returns
tuple[bytes | None, str | None]Encoded bytes and implied media type, when supplied.
def _content_type(headers: Headers, media: str) -> Headers: (source)

Validate or supply the media type for the chosen encoder.

Parameters
headers:HeadersHeader fields in request or wire order.
media:strMedia type implied by the body encoder.
Returns
HeadersValidated header pairs in transmission order.
def _copy_pairs(value: Pairs, limit: int) -> tuple[tuple[str, str], ...]: (source)

Copy text pairs while enforcing the unencoded size budget.

Parameters
value:PairsMapping or ordered sequence of text pairs.
limit:intMaximum byte count allowed for this operation.
Returns
tuple of tuple[str, str]Detached field pairs preserving ordering and duplicate keys.
def _escaped_field(text: str) -> bytes: (source)

Percent-encode one query or form field as ASCII.

Parameters
text:strText to encode using form percent-escaping.
Returns
bytesASCII form-encoded field.
def _json_content(value: object, limit: int) -> bytes: (source)

Encode JSON into a bounded UTF-8 buffer.

Parameters
value:objectJSON-native value to encode.
limit:intMaximum byte count allowed for this operation.
Returns
bytesStrict UTF-8 JSON representation.
def _urlencoded(values: Pairs, limit: int) -> bytes: (source)

Serialize ordered field pairs within the byte limit.

Parameters
values:PairsForm or query pairs, including any repeated keys.
limit:intMaximum byte count allowed for this operation.
Returns
bytesForm-encoded fields in input order.
def _validate_query(body: bytes | None, headers: Headers): (source)

Require explicit query content and a concrete media type for RFC 10008.

Parameters
body:bytes | NoneExplicitly supplied QUERY content.
headers:HeadersHeader fields in request or wire order.
Returns
NoneComplete validation of the query representation.
def merge_headers(*groups: Headers) -> Headers: (source)

Replace names case-insensitively and enforce the merged wire budget.

Parameters
*groups:HeadersHeader layers in ascending order of precedence.
Returns
HeadersValidated header pairs in transmission order.
def prepare(settings: Settings, allowed: frozenset[str], method: str, url: str, options: RequestOptions) -> PreparedRequest: (source)

Snapshot a request with an authorized URL, bounded body and fresh headers.

Parameters
settings:SettingsImmutable policy of the selected request chain.
allowed:frozenset[str]Canonical HTTPS origins permitted by the application.
method:strHTTP method for this attempt.
url:strAbsolute URL or path relative to the bound origin.
options:RequestOptionsQuery, headers and body arguments supplied to the terminal.
Returns
PreparedRequestAuthorized, serialized request ready for transport.
def seconds(value: float) -> float: (source)

Accept positive and finite time values expressed in seconds.

Parameters
value:floatRequested duration in seconds.
Returns
floatValidated duration in seconds.
def snapshot_options(options: RequestOptions, settings: Settings) -> RequestOptions: (source)

Own mutable arguments before queueing or passing them to a worker.

Parameters
options:RequestOptionsQuery, headers and body arguments supplied to the terminal.
settings:SettingsImmutable policy of the selected request chain.
Returns
RequestOptionsOptions detached from caller-owned mutable data.
def user_headers(values: Mapping[str, str], *, bound: bool) -> Headers: (source)

Validate application-supplied headers and copy their names and values.

Parameters
values:Mapping[str, str]User-supplied HTTP header mapping.
bound:boolWhether credentials may be scoped to a known origin.
Returns
HeadersValidated header pairs in transmission order.
_HEADER_NAME = (source)

Match ASCII token characters permitted in HTTP header names and media types.

Value
re.compile(r'[!#\$%&\'\*\+-\.\^_\|`~0-9A-Za-z]+\Z')
_MAX_JSON_DEPTH: int = (source)

Limit the nesting depth of a JSON request body.

Value
64
_MAX_JSON_VALUES: int = (source)

Limit the number of JSON values visited in a single request body.

Value
65536
_METHODS = (source)

Define the HTTP methods accepted by the outgoing request builder.

Value
frozenset(set(['GET',
               'HEAD',
               'OPTIONS',
               'QUERY',
               'POST',
               'PUT',
               'PATCH',
...
_PAIR_LENGTH: int = (source)

Require exactly two elements in each query or form field pair.

Value
2
_RESERVED = (source)

Reserve these header names for the transport and credential binding methods.

Value
frozenset(set(['authorization',
               'cookie',
               'cookie2',
               'host',
               'content-length',
               'transfer-encoding',
               'connection',
...
_UNBOUND = (source)

Allow these headers before a chain is bound to an origin.

Value
frozenset(set(['accept', 'content-type']))
MAX_HEADER_BYTES: int = (source)

Limit the combined size of request headers in bytes, including separators.

Value
16384

Keep immutable header name-value pairs in transmission order.

Value
tuple[tuple[str, str], ...]

Represent input fields as a mapping or an ordered sequence of key-value pairs.

Value
Mapping[str, str] | Sequence[tuple[str, str]]

Group connect, read, write and pool timeouts in seconds, in that order.

Value
tuple[float, float, float, float]