Rest Client API Documentation

anonlink-client includes a module for interacting with the Anonlink Entity Service.

class anonlinkclient.rest_client.ClientWaitingConfiguration(wait_exponential_multiplier_ms=10000, wait_exponential_max_ms=10000, stop_max_delay_ms=20000)[source]

Bases: object

DEFAULT_STOP_MAX_DELAY_MS = 20000
DEFAULT_WAIT_EXPONENTIAL_MAX_MS = 10000
DEFAULT_WAIT_EXPONENTIAL_MULTIPLIER_MS = 100
exception anonlinkclient.rest_client.RateLimitedClient(msg, response)[source]

Bases: anonlinkclient.rest_client.ServiceError

Exception indicating client is asking for updates too frequently.

class anonlinkclient.rest_client.RestClient(server, client_waiting_configuration=None)[source]

Bases: object

get_temporary_objectstore_credentials(project, apikey)[source]

Retrieve temporary object store credentials to upload

Parameters:
  • project – A project ID
  • apikey – A dataprovider’s upload token
Returns:

The credentials and upload information from the Anonlink Entity Service API.

project_create(schema, result_type, name, notes=None, parties=2, uses_blocking=False)[source]
project_delete(project, apikey)[source]
project_get_description(project, apikey)[source]
project_upload_clks(project, apikey, clk_data)[source]
run_create(project_id, apikey, threshold, name, notes=None)[source]
run_delete(project, run, apikey)[source]
run_get_result_text(project, run, apikey)[source]
run_get_status(project, run, apikey)[source]
server_get_status()[source]
wait_for_run(project, run, apikey, timeout=None, update_period=1)[source]

Monitor a linkage run and return the final status updates. If a timeout is provided and the run hasn’t entered a terminal state (error or completed) when the timeout is reached a TimeoutError will be raised.

Parameters:
  • project
  • run
  • apikey
  • timeout – Stop waiting after this many seconds. The default (None) is to never give you up.
  • update_period – Time in seconds between queries to the run’s status.
Raises:

TimeoutError – if timeout is reached

watch_run_status(project, run, apikey, timeout=None, update_period=1)[source]

Monitor a linkage run and yield status updates. Will immediately yield an update and then only yield further updates when the status object changes. If a timeout is provided and the run hasn’t entered a terminal state (error or completed) when the timeout is reached, updates will cease and a TimeoutError will be raised.

Parameters:
  • project
  • run
  • apikey
  • timeout – Stop waiting after this many seconds. The default (None) is to never give you up.
  • update_period – Time in seconds between queries to the run’s status.
Raises:

TimeoutError – if timeout is reached

exception anonlinkclient.rest_client.ServiceError(msg, response)[source]

Bases: Exception

Problem with the upstream API

anonlinkclient.rest_client.format_run_status(status)[source]