Parameters & Converters¶
The declarations that bind a handler's arguments to parts of the request, and the path converters behind them.
Path
¶
Query
¶
Header
¶
Cookie
¶
Body
¶
Form
¶
File
¶
Converter
¶
Base class - subclasses override match and may set greedy.
register_converter
¶
register_converter(name: str, converter_cls: type[Converter]) -> None
Register a custom path converter.
After register_converter("slug", SlugConverter), routes may use
{post:slug} and the radix tree validates/coerces the segment via
SlugConverter().match(...). converter_cls must subclass
Converter. A built-in name cannot be shadowed -
that raises ValueError.
unregister_converter
¶
Remove a converter registered with register_converter.
No-op when name was never registered. A built-in name is refused with
ValueError, matching register_converter: the built-ins are not the
caller's to remove, and silently ignoring the attempt would leave a test
or a plugin believing it had.
Routes already registered against the converter keep the instance they were
built with - parse_converter runs at registration time, not at match
time - so this affects only routes registered afterwards.
RouteInfo
¶
Stored route metadata.
RouteMatch
¶
Result of matching a path against the tree.