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

Constructor: Headers(raw, decode)

View In Hierarchy

Undocumented

Method __contains__ Check whether the given header key is present.
Method __getitem__ Return the last value for the given header key.
Method __init__ Initialize Headers from an iterable of key-value pairs.
Method __iter__ Iterate over all header key-value pairs.
Method __len__ Return the total number of header entries.
Method __repr__ Return the canonical string representation of this instance.
Method byteItems Yield all header pairs as UTF-8 encoded byte strings.
Method count Return the number of occurrences of a header name.
Method get Return the last value for the given header key.
Method getAll Return all values for a key, or a mapping of all headers.
Method hasInvalidFormat Report whether any header contains a carriage return or newline.
Method items Return a copy of all header key-value pairs.
Method keys Return the set of unique header names.
Method values Return all header values in insertion order.
Class Variable __slots__ Undocumented
Instance Variable _has_invalid_format Undocumented
Instance Variable _index Undocumented
Instance Variable _items Undocumented
def __contains__(self, key: str) -> bool: (source)

Check whether the given header key is present.

Parameters
key:strCase-insensitive header name to check.
Returns
boolTrue if at least one entry matches, False otherwise.
def __getitem__(self, key: str) -> str: (source)

Return the last value for the given header key.

Parameters
key:strCase-insensitive header name to retrieve.
Returns
strLast value associated with the key.
Raises
KeyErrorIf the header key is not found.
def __init__(self, raw: Iterable[tuple[str, str]] | Iterable[tuple[bytes, bytes]], *, decode: bool = False): (source)

Initialize Headers from an iterable of key-value pairs.

Parameters
raw:Iterable[tuple[str, str]] | Iterable[tuple[bytes, bytes]]Iterable of (header_name, header_value) pairs.
decode:bool, optionalDecode transport byte pairs using Latin-1 before indexing.
Returns
NoneUndocumented
def __iter__(self) -> Iterator[tuple[str, str]]: (source)

Iterate over all header key-value pairs.

Returns
Iterator[tuple[str, str]]An iterator over (name, value) pairs.
def __len__(self) -> int: (source)

Return the total number of header entries.

Returns
intNumber of (name, value) pairs stored.
def __repr__(self) -> str: (source)

Return the canonical string representation of this instance.

Returns
strUnambiguous representation showing all stored header pairs.
def byteItems(self) -> Iterator[tuple[bytes, bytes]]: (source)

Yield all header pairs as UTF-8 encoded byte strings.

Returns
Iterator[tuple[bytes, bytes]]Each (name, value) pair encoded as UTF-8 bytes.
def count(self, key: str) -> int: (source)

Return the number of occurrences of a header name.

Parameters
key:strCase-insensitive header name.
Returns
intNumber of entries for the name.
def get(self, key: str, default: str | None = None) -> str | None: (source)

Return the last value for the given header key.

Parameters
key:strCase-insensitive header name to look up.
default:str | None, optionalValue returned when the key is absent (default None).
Returns
str | NoneLast matching value, or default if not found.
def getAll(self, key: str | None = None) -> dict[str, list[str]] | list[str]: (source)

Return all values for a key, or a mapping of all headers.

Parameters
key:str | None, optionalHeader name to look up. When None, returns a dict mapping every lowercase header name to its values.
Returns
dict[str, list[str]] | list[str]
  • dict[str, list[str]] - All headers grouped by name when key is None.
  • list[str] - Ordered list of values for the specified header, or an empty list when the header is absent.
def hasInvalidFormat(self) -> bool: (source)

Report whether any header contains a carriage return or newline.

Returns
boolWhether the immutable input contains a CRLF injection marker.
def items(self) -> list[tuple[str, str]]: (source)

Return a copy of all header key-value pairs.

Returns
list[tuple[str, str]]All (name, value) pairs in insertion order.
def keys(self) -> set[str]: (source)

Return the set of unique header names.

Returns
set[str]All unique header names in their original casing.
def values(self) -> list[str]: (source)

Return all header values in insertion order.

Returns
list[str]All header values as a list.
__slots__: tuple[str, ...] = (source)

Undocumented

_has_invalid_format = (source)

Undocumented

Undocumented

Undocumented