benchclients API documentation

class benchclients.BaseClient(adapter)

Bases: ABC

A client to interact with an API.

Parameters:

adapter (Optional[HTTPAdapter]) – A requests adapter to mount to the requests session. If not given, one will be created with a backoff retry strategy.

get(path, params=None)

Make a GET request

Return type:

dict

post(path, json=None)

Make a POST request

Return type:

Optional[dict]

put(path, json)

Make a PUT request

Return type:

Optional[dict]

class benchclients.ConbenchClient(url=None, email=None, password=None, default_retry_for_seconds=None)

Bases: RetryingHTTPClient

HTTP client abstraction for interacting with a Conbench HTTP API server.

Environment variables

CONBENCH_URL

Required. Base URL of the Conbench API server. Must not end with /api.

CONBENCH_EMAIL

The email address to use for Conbench login. Required for submitting data.

CONBENCH_PASSWORD

The password to use for Conbench login. Required for submitting data.

Credentials can be left undefined when only reading state from a ‘public mode’ API server.

get_all(path, params=None)

Make GET requests to a paginated Conbench endpoint. Expect responses with status code 200, expect a JSON document in the response body of the form {“data”: List[dict], “metadata”: {“next_page_cursor”: Optional[str]}}.

Return the deserialized concatenation of the JSON data or raise an exception.

params can be used to pass URL query parameters, including “page_size”. If “cursor” is given in params, it will be overwritten after the first request.

Return type:

List[dict]

property url: str

Return the base URL of the Conbench API server.

benchclients.fatal_and_log(msg, etype=<class 'ValueError'>)

If an error occurs, log the message and raise an exception.