snip.api.schemas

Interface with schema related endpoints.

Provides functions to retrieve available schemas and specific schema details from a given snip deployment.

Functions

get_available_schemas([deployment])

Get all available schemas from the deployment.

get_schema(name[, deployment])

Get a schema from the deployment.

Module Functions

snip.api.schemas.get_available_schemas(deployment: str | None = None, **kwargs) list[str]

Get all available schemas from the deployment.

Parameters:
  • deployment (str, optional) – The deployment to get the available schemas from. If None, the default deployment is used.

  • **kwargs (Any) – Additional keyword arguments to pass to the requests.get function.

Returns:

The list of available schemas.

Return type:

list[str]

Raises:

requests.HTTPError – If the request to the deployment fails. Should only happen if the deployment is not reachable.

snip.api.schemas.get_schema(name: str, deployment: str | None = None, **kwargs) Dict

Get a schema from the deployment.

Parameters:
  • name (str) – The name of the schema to retrieve i.e. its identifier e.g. “text” or “uprp/timestamp”

  • deployment (str, optional) – The deployment to get the schema from. If None, the default deployment is used.

  • **kwargs (Any) – Additional keyword arguments to pass to the requests.get function.

Returns:

The schema object.

Return type:

Dict

Raises:

requests.HTTPError – If the request to the deployment fails. Can happen if the deployment is not reachable or if the schema is not found. Check the response for more information.