Skip to content

prefect.client.collections

get_collections_metadata_client(httpx_settings=None)

Creates a client that can be used to fetch metadata for Prefect collections.

Will return a CloudClient if profile is set to connect to Prefect Cloud, otherwise will return an OrchestrationClient.

Source code in src/prefect/client/collections.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
def get_collections_metadata_client(
    httpx_settings: Optional[Dict] = None,
) -> "CollectionsMetadataClient":
    """
    Creates a client that can be used to fetch metadata for
    Prefect collections.

    Will return a `CloudClient` if profile is set to connect
    to Prefect Cloud, otherwise will return an `OrchestrationClient`.
    """
    orchestration_client = get_client(httpx_settings=httpx_settings)
    if orchestration_client.server_type == ServerType.CLOUD:
        return get_cloud_client(httpx_settings=httpx_settings)
    else:
        return orchestration_client