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
Parse and expose HTTP headers with case-insensitive lookup.
| Class Method | _from |
Index grouped RSGI headers while normalizing each name once. |
| 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 | byte |
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 | get |
Return all values for a key, or a mapping of all headers. |
| Method | has |
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__ |
Declare the instance attribute slots reserved by this class. |
| Instance Variable | _has |
Has invalid format supplied through invalid. |
| Instance Variable | _index |
Lookup index used to resolve registered entries. |
| Instance Variable | _items |
Items supplied through items. |
Index grouped RSGI headers while normalizing each name once.
| Parameters | |
raw:granian.rsgi.Headers | Transport collection exposing header names and get_all values. |
| Returns | |
typing.Self | Headers retaining duplicate order, owned lists and CRLF validation. |
def __init__(self:
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, optional | Decode transport byte pairs using Latin-1 before indexing. |
| Returns | |
None | Initialize Headers from an iterable of key-value pairs. |
Iterate over all header key-value pairs.
| Returns | |
collections.abc.Iterator[tuple[str, str]] | An iterator over (name, value) pairs. |
Return the canonical string representation of this instance.
| Returns | |
str | Unambiguous representation showing all stored header pairs. |
Yield all header pairs as UTF-8 encoded byte strings.
| Returns | |
collections.abc.Iterator[tuple[bytes, bytes]] | Each (name, value) pair encoded as UTF-8 bytes. |
Return the last value for the given header key.
| Parameters | |
key:str | Case-insensitive header name to look up. |
default:str | None, optional | Value returned when the key is absent (default None). |
| Returns | |
str | None | Last matching value, or default if not found. |
Report whether any header contains a carriage return or newline.
| Returns | |
bool | Whether the immutable input contains a CRLF injection marker. |