Provides access to all API resources from any Python software component. The methods from all the mix-ins are available on this method as well:
Table of Contents
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
class squirro_client.base.SquirroClient
class squirro_client.base.SquirroClient(client_id, client_secret, **kwargs)
Client to access the Squirro API.
- 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.
- bulk_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:
Code Block | ||
---|---|---|
| ||
>>> 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) |
access_token
Property to get or set the access token of the client.
refresh_token
Property to get or set the refresh token of the client.
authenticate
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.
- 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.
squirro_client.exceptions.AuthenticationError
if authentication fails.
Example:
language | python |
---|
Info |
---|
The SquirroClient Reference has now been moved to the Developer Documentation and can be accessed there. |