Back to Prefect

dependencies

docs/v3/api-ref/python/prefect-server-api-dependencies.mdx

3.6.30.dev33.4 KB
Original Source

prefect.server.api.dependencies

Utilities for injecting FastAPI dependencies.

Functions

provide_request_api_version <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/dependencies.py#L23" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
provide_request_api_version(x_prefect_api_version: str = Header(None)) -> Version | None

LimitBody <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/dependencies.py#L105" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
LimitBody() -> Any

A fastapi.Depends factory for pulling a limit: int parameter from the request body while determining the default from the current settings.

get_created_by <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/dependencies.py#L134" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_created_by(prefect_automation_id: Optional[UUID] = Header(None, include_in_schema=False), prefect_automation_name: Optional[str] = Header(None, include_in_schema=False)) -> Optional[schemas.core.CreatedBy]

A dependency that returns the provenance information to use when creating objects during this API call.

get_updated_by <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/dependencies.py#L156" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_updated_by(prefect_automation_id: Optional[UUID] = Header(None, include_in_schema=False), prefect_automation_name: Optional[str] = Header(None, include_in_schema=False)) -> Optional[schemas.core.UpdatedBy]

A dependency that returns the provenance information to use when updating objects during this API call.

is_ephemeral_request <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/dependencies.py#L172" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
is_ephemeral_request(request: Request) -> bool

A dependency that returns whether the request is to an ephemeral server.

get_prefect_client_version <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/dependencies.py#L184" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_prefect_client_version(user_agent: Annotated[Optional[str], Header(include_in_schema=False)] = None) -> Optional[str]

Attempts to parse out the Prefect client version from the User-Agent header.

docket <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/dependencies.py#L201" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
docket(request: Request) -> Docket_

Classes

EnforceMinimumAPIVersion <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/prefect/server/api/dependencies.py#L43" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

FastAPI Dependency used to check compatibility between the version of the api and a given request.

Looks for the header 'X-PREFECT-API-VERSION' in the request and compares it to the api's version. Rejects requests that are lower than the minimum version.