Client

class tamr_unify_client.Client(auth, host='localhost', protocol='http', port=9100, base_path='/api/versioned/v1/', session=None, store_auth_cookie=False)[source]

Python Client for Tamr API.

Each client is specific to a specific origin (protocol, host, port).

Parameters
  • auth (AuthBase) –

    Tamr-compatible Authentication provider.

    Recommended: use one of the classes described in Authentication

  • host (str) – Host address of remote Tamr instance (e.g. '10.0.10.0')

  • protocol (str) – Either 'http' or 'https'

  • port (Optional[int]) – Tamr instance main port

  • base_path (str) – Base API path. Requests made by this client will be relative to this path.

  • session (Optional[Session]) – Session to use for API calls. If none is provided, will use a new requests.Session.

Example

>>> from tamr_unify_client import Client
>>> from tamr_unify_client.auth import UsernamePasswordAuth
>>> auth = UsernamePasswordAuth('my username', 'my password')
>>> tamr_local = Client(auth) # on http://localhost:9100
>>> tamr_remote = Client(auth, protocol='https', host='10.0.10.0') # on https://10.0.10.0:9100
>>> tamr_remote = Client(auth, protocol='https', host='10.0.10.0', port=None) # on https://10.0.10.0
property origin

HTTP origin i.e. <protocol>://<host>[:<port>].

For additional information, see MDN web docs .

Return type

str

request(method, endpoint, **kwargs)[source]

Sends a request to Tamr.

The URL for the request will be <origin>/<base_path>/<endpoint>. The request is authenticated via Client.auth.

Parameters
  • method (str) – The HTTP method to use (e.g. ‘GET’ or ‘POST’)

  • endpoint (str) – API endpoint to call (relative to the Base API path for this client).

Return type

Response

Returns

HTTP response from the Tamr server

get(endpoint, **kwargs)[source]

Calls request() with the "GET" method.

post(endpoint, **kwargs)[source]

Calls request() with the "POST" method.

put(endpoint, **kwargs)[source]

Calls request() with the "PUT" method.

delete(endpoint, **kwargs)[source]

Calls request() with the "DELETE" method.

Fetch and store an auth token for the given client configuration

property projects

Collection of all projects on this Tamr instance.

Return type

ProjectCollection

Returns

Collection of all projects.

property datasets

Collection of all datasets on this Tamr instance.

Return type

DatasetCollection

Returns

Collection of all datasets.