Skip to content

Context

faststream.broker.fastapi.context.Context #

Context(name: str, *, default: Any = Signature.empty, initial: Optional[Callable[..., Any]] = None) -> Any
Source code in faststream/broker/fastapi/context.py
def Context(  # noqa: N802
    name: str,
    *,
    default: Any = Signature.empty,
    initial: Optional[Callable[..., Any]] = None,
) -> Any:
    return params.Depends(
        lambda: resolve_context_by_name(
            name=name,
            default=default,
            initial=initial,
        ),
        use_cache=True,
    )