Rest Client API Documentation

clkhash includes a module for interacting with the anonlink-entity-service.

exception clkhash.rest_client.RateLimitedClient(msg, response)[source]

Bases: clkhash.rest_client.ServiceError

Exception indicating client is asking for updates too frequently.

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

Bases: Exception

Problem with the upstream API

clkhash.rest_client.format_run_status(status)[source]
clkhash.rest_client.project_create(server, schema, result_type, name, notes=None, parties=2)[source]
clkhash.rest_client.project_delete(server, project, apikey)[source]
clkhash.rest_client.project_get_description(server, project, apikey)[source]
clkhash.rest_client.project_upload_clks(server, project, apikey, clk_data)[source]
clkhash.rest_client.run_create(server, project_id, apikey, threshold, name, notes=None)[source]
clkhash.rest_client.run_delete(server, project, run, apikey)[source]
clkhash.rest_client.run_get_result_text(server, project, run, apikey)[source]
clkhash.rest_client.run_get_status(server, project, run, apikey)[source]
clkhash.rest_client.server_get_status(server)[source]
clkhash.rest_client.wait_for_run(server, 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:
  • server – Base url of the upstream server.
  • 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

clkhash.rest_client.watch_run_status(server, 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:
  • server – Base url of the upstream server.
  • 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