Skip to content

Parameters

Where a parameter comes from when its annotation alone doesn't say. See Validation and Dependencies.

Query

Query(default: Any = REQUIRED, *, alias: str | None = None) -> Any

From the query string; alias gives a name that isn't a Python identifier.

Guide: https://3d3n-pyc.github.io/korvex/validation/#headers-cookies-and-forms

Header

Header(default: Any = REQUIRED, *, alias: str | None = None) -> Any

From a request header (x_client reads X-Client); alias gives the exact name.

A list[str] gets every value of a repeated header. Guide: https://3d3n-pyc.github.io/korvex/validation/#headers-cookies-and-forms

Cookie

Cookie(default: Any = REQUIRED, *, alias: str | None = None) -> Any

From a cookie of that name (or alias).

Guide: https://3d3n-pyc.github.io/korvex/validation/#headers-cookies-and-forms

Form

Form(default: Any = REQUIRED, *, alias: str | None = None) -> Any

From a form field, urlencoded or multipart; annotated UploadedFile, a file.

Annotated with a msgspec or pydantic model, each of its fields is read from the form field of that name. Guide: https://3d3n-pyc.github.io/korvex/validation/#headers-cookies-and-forms

Depends

Depends(dependency: Callable[..., Any], *, cache: bool = True) -> Any

The value dependency returns (or yields), computed before the handler runs.

  • cache: call it once per request; False calls it for each parameter

Guide: https://3d3n-pyc.github.io/korvex/dependencies/