Introduction to SDK
Welcome to the Eizen SDK documentation! This SDK is a Python package designed to provide a simple interface for interacting with the Eizen Analytics API. It handles authentication through Keycloak and offers various methods to facilitate integration. By using this SDK, you can seamlessly incorporate video analytics into your applications.
Key Features
- The Eizen software package operates in the cloud.
- The Eizen software package can also run on-premises.
Installation of Eizen SDK
To get started, ensure you have Python 3.7 or higher installed. You can install the package using the following command:
pip install eizen-sdk
Upgrading Eizen SDK
To upgrade to the latest version of the Eizen SDK, use:
pip install --upgrade eizen-sdk
Importing and Initializing the SDK
To begin using the SDK, import the package and initialize it with your authentication access token. This will grant you access to various API methods.
Example Usage:
For Eizen Environment SDK:
from eizen_sdk import EizenSDK
sdk = EizenSDK(
refresh_token="<User Token>",
environment="<Eizen Environment>" # Options: ldev or dev
)
print("Initialized successfully")
**For On-Premises System:**
from eizen_sdk import EizenSDK
sdk = EizenSDK(
refresh_token="<User Token>",
base_url="<Kong Service URL>",
client_id="<Keycloak Client ID>"
)
print("Initialized successfully")
### **Authentication**
The Eizen SDK manages authentication through Keycloak, ensuring secure access to the Eizen Analytics API. During initialization, the SDK retrieves an access token using the provided API key. This token is automatically refreshed upon expiration, guaranteeing uninterrupted access to the API.
## **Functions To Access SDK:**
### **Grant Access To User:**
To grant access to a user, use the grant\_access method.
### **Description**
This method adds 1000 credits to the user and grants access for 7 days to use the SDK.
|**Parameter**|**Type**|**Required**|**Description**|
| :-: | :-: | :-: | :-: |
|user\_email|String|Yes|User's Email ID|
grant\_access = sdk.grant\_access(
` `user\_email="user@email.com"
)
print(grant\_access)
### **Check Access To User:**
To check whether a user has access to the SDK, use the check\_access method.
### **Description**
This method verifies if the user has access to the SDK.
|**Parameter**|**Type**|**Required**|**Description**|
| :-: | :-: | :-: | :-: |
|user\_email|String|Yes|User's Email ID|
check\_access = sdk.check\_access(
` `user\_email="user@email.com"
)
print(check\_access)
### **Get User Refresh Token**
To obtain the refresh token for SDK access, use the get\_token method.
### **Description**
This method generates a refresh token for the user to access the SDK.
|**Parameter**|**Type**|**Required**|**Description**|
| :-: | :-: | :-: | :-: |
|user\_email|String|Yes|User's Email ID|
|password|String|Yes|User's Password|
token = sdk.get\_token(user\_email="cody1admintest@eizen.ai", password="1234")
print(token)
### **Error Handling**
If any request fails, the Eizen SDK raises an exception that includes the HTTP status code and a detailed error message. This feature allows for quick identification and resolution of issues such as authentication failures, invalid parameters, or server errors.