Depends
Declare a FastAPI dependency. It takes a single "dependable" callable (like a function). Don't call it directly, FastAPI will call it for you.
def Depends(
dependency: Callable[..., Any] | None = None,
use_cache: bool = True,
scope: Literal["function", "request"] | None = None
) - > Any
Declare a FastAPI dependency. It takes a single "dependable" callable (like a function). Don't call it directly, FastAPI will call it for you.
Parameters
| Name | Type | Description |
|---|---|---|
| dependency | `Callable[..., Any] | None` = None |
| use_cache | bool = True | By default, after a dependency is called the first time in a request, if the dependency is declared again for the rest of the request (for example if the dependency is needed by several dependencies), the value will be re-used for the rest of the request. Set use_cache to False to disable this behavior and ensure the dependency is called again (if declared more than once) in the same request. |
| scope | `Literal["function", "request"] | None` = None |
Returns
| Type | Description |
|---|---|
Any |