benchling_api_client.client module

class AuthenticatedClient

Bases: benchling_api_client.client.Client

A Client which has been authenticated for use on secured endpoints

__init__(base_url: str, token: str, *, cookies: Dict[str, str] = NOTHING, headers: Dict[str, str] = NOTHING, timeout: float = attr_dict['timeout'].default) None

Method generated by attrs for class AuthenticatedClient.

get_headers() Dict[str, str]

Get headers to be used in authenticated endpoints

token: str
class Client

Bases: object

A class for keeping track of data related to the API

__init__(base_url: str, *, cookies: Dict[str, str] = NOTHING, headers: Dict[str, str] = NOTHING, timeout: float = attr_dict['timeout'].default) None

Method generated by attrs for class Client.

base_url: str
cookies: Dict[str, str]
get_cookies() Dict[str, str]
get_headers() Dict[str, str]

Get headers to be used in all endpoints

get_timeout() float
headers: Dict[str, str]
timeout: float
with_cookies(cookies: Dict[str, str]) Client

Get a new client matching this one with additional cookies

with_headers(headers: Dict[str, str]) Client

Get a new client matching this one with additional headers

with_timeout(timeout: float, increase_only: bool = True) Client

Get a new client matching this one with a new timeout (in seconds).

Parameters
  • timeout – The new client timeout in seconds

  • increase_only – If True, will only use the specified timeout if it’s

higher than the existing Client timeout :return: A new Client with the adjusted timeout :rtype: Client