Obtaining a client

Internally, zds-client is used to resolve remote API objects where the API is documented using OpenAPI 3 specifications.

Subclasses of the base Client class can also be used, in a pluggable fashion. By default, the base class is used in combination with vng_api_common.models.APICredential.

Public API


The setting CUSTOM_CLIENT_FETCHER is a string with the dotted path to a callable taking a single url string argument. The callable should return a ready-to-use client instance for that particular URL, or None if no suitable client can be determined.

Interface to get a zds_client object for a given URL.

vng_api_common.client.get_client(url: str, url_is_api_root=False) Optional[Client]

Get a client instance for the given URL.

If the setting CUSTOM_CLIENT_FETCHER is defined, then this callable is invoked. Otherwise we fall back on the default implementation.

If no suitable client is found, None is returned.