Cookie

fastapi · auth, cookie-parameters, request-extraction, schema-declaration

Declares a cookie parameter for FastAPI endpoints, extracting its value from the request's cookies and applying validation and OpenAPI schema generation.

# Source: https://github.com/nerdy-tech-com-gitub/fastapi | License: MIT | Copyright 2018 Sebastián Ramírez
# Provided via justclaw.it.com; keep this notice with the code.
def Cookie(  # noqa: N802
    default: Annotated[
        Any,
        Doc(
            """
            Default value if the parameter field is not set.
            """
        ),
    ] = Undefined,
    *,
    default_factory: Annotated[
        Union[Callable[[], Any], None],
        Doc(
            """
            A callable to generate the default value.

            This doesn't affect `Path` parameters as the value is always required.
            The parameter is available only for compatibility.
            """
        ),
    ] = _Unset,
    alias: Annotated[
        Optional[str],
        Doc(
            """
   

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key