API¶
HTTP client¶
-
class
jexia_sdk.http.
HTTPClient
(domain='jexia.com', ssl_check=True)¶ Class represents HTTP client for Jexia platform.
>>> client = HttpClient() >>> client.auth_management('test@example.com', 'password')
- Parameters
domain (str) – the main domain of Jexia platform, default to jexia.com
ssl_check (bool) – enable/disable SSL checking for requests, defaults to True
-
auth_consumption
(project, method, key=None, secret=None, email=None, password=None)¶ The method used to authenticate the client on the consumption level.
- Parameters
project (str) – project of Jexia’s account
method (str) – authentication method, can be ‘apk’ or ‘ums’
key (str) – application key for the project, required for apk method
secret (str) – application secret for the project, required for apk method
email (str) – user’s email address, required for ums method
password (str) – user’s password, required for ums method
-
auth_management
(email, password)¶ The method used to authenticate the client on the management level.
- Parameters
email (str) – email address of Jexia’s account
password (str) – password of Jexia’s account
-
is_authenticated
()¶ The method checks the client was authenticated or not.
-
request
(method, url, data=None, headers=None, timeout=10, check_token=True, **params)¶ The method to make a request to Jexia’s API with authentication.
- Parameters
method (str) – HTTP method for the request (GET, POST, etc.)
url (str) – URL to call in the request
data (dict) – data for JSON body
headers (dict) – additional headers for request
timeout (int) – timeout of request, defaults to 10 seconds
check_token (bool) – disable/enable access token checking before request
params – query params for request
-
exception
jexia_sdk.http.
HTTPClientError
¶ Basic exception for HTTPClient errors.
-
exception
jexia_sdk.http.
HTTPRequestError
(request_exc)¶ Class for HTTP errors if response contains status code 4xx or 5xx.
- Parameters
request_exc – requests.exceptions.HTTPError exception