Client
Module superwise.utils.client
wrapper for requests class and superwise token handling
Functions
token_retry(input_func)
Description:
A decorator for token retry handling (ie, refresh token if needed)
Classes
Client(client_id, secret, api_host, email=None, password=None)
A Client for http requests, set of wrappers around requests library
Args:
client_id
: user client token id (string)
secret
: secret token (string)
api_host
: superwise api server host
email
: optional email
password
: Optional password
Instance variables
accessToken
headers
Description:
Return:
Headers to send (dict)
Methods
build_headers(self)
Description:
Return:
Headers to send (dict)
build_url(self, path)
Description:
Build an url for a given path
Args:
path
: relative path, normally declared in each model (subclasses of this class)
Return:
URL string
delete(*args, **kwargs) ‑> requests.models.Response
get(*args, **kwargs) ‑> requests.models.Response
get_access_token(self)
get_tenant_id(self, token) ‑> str
Description:
Get tenant id from JWT token
Args:
token
: secret token (string)
Return:
tenant_id string
get_token(self) ‑> str
Description:
Get bearer token to use in each API call
Return:
token string
patch(*args, **kwargs) ‑> requests.models.Response
post(*args, **kwargs) ‑> requests.models.Response
refresh_token(self)
Description:
refresh bearer token
Return:
token string