Platform API Client

class enlyze.api_client.client.PlatformApiClient[source]

API Client class encapsulating all interaction with the ENLYZE platform

Parameters:
  • token (str) – API token for the ENLYZE platform

  • base_url (str | URL) – Base URL of the ENLYZE platform

  • timeout (float) – Global timeout for all HTTP requests sent to the ENLYZE platform

get(api_path, **kwargs)[source]

Wraps httpx.Client.get() with defensive error handling

Parameters:

api_path (str | URL) – Relative URL path inside the API name space (or a full URL)

Returns:

JSON payload of the response as Python object

Raises:

EnlyzeError on request failure

Raises:

EnlyzeError on non-2xx status code

Raises:

EnlyzeError on non-JSON payload

Return type:

Any

post(api_path, **kwargs)[source]

Wraps httpx.Client.post() with defensive error handling

Parameters:

api_path (str | URL) – Relative URL path inside the API name space (or a full URL)

Returns:

JSON payload of the response as Python object

Raises:

EnlyzeError on request failure

Raises:

EnlyzeError on non-2xx status code

Raises:

EnlyzeError on non-JSON payload

Return type:

Any

get_paginated(api_path, model, **kwargs)[source]

Retrieve objects from a paginated ENLYZE platform API endpoint via HTTP GET

Parameters:
  • api_path (str | URL) – Relative URL path inside the ENLYZE platform API

  • model (Type[T]) – API response model class derived from PlatformApiModel

Returns:

Instances of model retrieved from the api_path endpoint

Raises:

EnlyzeError on invalid pagination schema

Raises:

EnlyzeError on invalid data schema

Raises:

see get() for more errors raised by this method

Return type:

Iterator[T]

post_paginated(api_path, model, **kwargs)[source]

Retrieve objects from a paginated ENLYZE platform API endpoint via HTTP POST

Parameters:
  • api_path (str | URL) – Relative URL path inside the ENLYZE platform API

  • model (Type[T]) – API response model class derived from PlatformApiModel

Returns:

Instances of model retrieved from the api_path endpoint

Raises:

EnlyzeError on invalid pagination schema

Raises:

EnlyzeError on invalid data schema

Raises:

see post() for more errors raised by this method

Return type:

Iterator[T]