REST Client

The REST client provides low-level access to non-GraphQL endpoints used by the GPP client.

It manages authenticated HTTP sessions and provides the underlying transport layer for REST-based operations.

Warning

This is considered advanced functionality and is rarely needed directly.

Most users should prefer using the domain interfaces exposed through GPPClient.

API Reference

class gpp_client.rest.RESTClient(base_url: str, gpp_token: str, timeout: float = 30.0)[source]

Bases: object

REST API client to non-GraphQL requests that help with the function of managers and coordinators.

Parameters:
  • base_url (str) – Base URL of the REST API. Derived from GPPClient base_url.

  • gpp_token (str) – GPP token to authenticate against the REST API. Same as GPPClient.

  • timeout (float) – Timeout for REST API requests in seconds.

async close() None[source]

Close the session if it exists and is not already closed.

async get_atom_digests(observation_ids: list[str], accept_gzip: bool = True) str[source]

Request atom digests for the given observation IDs.

Parameters:
  • observation_ids (list[str]) – (internal) IDs of the observation to request.

  • accept_gzip (bool) – Endpoint allows to return a gzip-compressed representation of the complete atoms digest in the case of being too big.

Returns:

TSV data as string, one row per line.

Return type:

str

Raises:
  • aiohttp.ClientResponseError – For HTTP error responses.

  • aiohttp.ClientError – For connection or timeout failures.

async get_session() ClientSession[source]

Get or create an aiohttp.ClientSession for making REST API requests.

Returns:

The aiohttp ClientSession instance.

Return type:

aiohttp.ClientSession

async get_visibility_changes(since: datetime) str[source]

Request observations and targets with visibility changes since a time.

Parameters:

since (datetime) – Return entities whose visibility-relevant inputs changed at or after this time. Naive datetimes are assumed to be UTC.

Returns:

TSV data as string, one <gid>\t<iso8601-timestamp> per line.

Return type:

str

Raises:
  • aiohttp.ClientResponseError – For HTTP error responses.

  • aiohttp.ClientError – For connection or timeout failures.