SquirroClient Setup Class#
Instantiation and authorization of the Squirro Client.
- class SquirroClient(client_id, client_secret, **kwargs)#
Client to access the Squirro API.
- Parameters
client_id – The client id for accessing the API.
client_secret – The client secret for accessing the API.
cluster – The cluster endpoint for accessing the API.
user_api_url – Endpoint URL for the user API service.
topic_api_url – Endpoint URL for the topic API service.
tenant – Tenant domain.
version – API version to use, defaults to ‘v0’.
requests – requests instance for HTTP calls.
retry_total – Total number of retries to allow. Takes precedence over other counts.
retry_connect – How many connection-related errors to retry on.
retry_read – How many times to retry on read errors.
retry_redirect – How many redirects to perform.
retry_method_whitelist – Set of uppercase HTTP method verbs that we should retry on.
retry_status_forcelist – A set of integer HTTP status codes that we should force a retry on.
retry_backoff_factor – A backoff factor to apply between attempts.
timeout_secs – How many seconds to wait for data before giving up (default 55).
Example:
>>> from squirro_client import SquirroClient >>> client = SquirroClient('client_id', 'client_secret') >>> client = SquirroClient(None, None, ... cluster='http://squirro.example.com') >>> client = SquirroClient(None, None, ... cluster='http://squirro.example.com', ... retry_total=10)
- property access_token#
Property to get or set the access token of the client.
- property refresh_token#
Property to get or set the refresh token of the client.
- authenticate(tenant=None, access_token=None, refresh_token=None, auth_service=None, auth_user=None, username=None, password=None, user_information=None)#
Authenticate with the Squirro platform by either using access and refresh tokens, username and password, or external service name and user identifier.
- Parameters
tenant – The tenant for accessing the Squirro platform.
access_token – User access token.
refresh_token – User refresh token.
auth_service – External authentication service name.
auth_user – External authentication user identifier.
username – User name.
password – User password.
user_information – Additional information about the user for internal use.
- Raises
squirro_client.exceptions.AuthenticationError
if authentication fails.
Example:
>>> client.authenticate(username='[email protected]', ... password='test') >>> client.authenticate(access_token='token01', ... refresh_token='token02') >>> client.authenticate(auth_service='salesforce', ... auth_user='sfdc01')