Module

routing.params

Path parameter parsing and type conversion.

Built-in converters for route path segments like{id:int}.

Functions

convert_param 2 str | int | float
Convert a captured path parameter string to the target type. Raises ``ValueErr…
def convert_param(value: str, param_type: str) -> str | int | float

Convert a captured path parameter string to the target type.

RaisesValueErrorif the string cannot be converted. RaisesKeyErrorif param_type is not a registered converter.

Parameters
Name Type Description
value str
param_type str
Returns
str | int | float