4.0
You are viewing documentation for an older version of Lenses.io View latest documentation here
Python client
Lenses python-library is a Python client enabling Python developers and data scientists to take advantage of the Rest and WebSocket endpoints Lenses exposes.
Runtime Dependencies
- requests 2.22.0
 - websocket-client 0.56.0
 - kerberos 1.3.0
 
Install Lenses Python
Install using pip.
pip3 install dist/lensesio-3.0.0-py3-none-any.whl
Install with Kerberos support (Only Linux / Darwin)
pip3 install dist/lensesio-3.0.0-py3-none-any.whl[kerberos]
Authentication
There are three different ways that can be used for authentication.
| Parameter Name | Description | 
|---|---|
| basic Basic | Authentication (Accont) | 
| service | Service Account (Token Based) | 
| krb5 | Kerberos Authentication | 
Basic authentication
| Parameter Name | Description | Required | Type | 
|---|---|---|---|
| auth_type | Authentication Type | Yes | String | 
| url | Lenses Endpoint | Yes | String | 
| username | Username | Yes | String | 
| password | Password | Yes | String | 
For basic authentication, issue:
from lensesio.lenses import main as main
lenses_lib = main(
    auth_type="basic",
    url=lenses_endpoint,
    username=user,
    password=psk
)
where lenses_endpoint, user, psk are python variables set by you with the endpoint, username and password
Kerberos authentication
| Parameter Name | Description | Required | Type | 
|---|---|---|---|
| auth_type | Authentication | Type | Yes | 
| url | Lenses Endpoint | Yes | String | 
| krb_service Service | Yes | String | 
pip3 install dist/lensesio-3.0.0-py3-none-any.whl[kerberos]
For Kerberos authentcation, issue:
from lensesio.lenses import main
lenses_lib = main(
    auth_type="krb5",
    url="http://localhost:3030",
    krb_service="HTTP@primef.dev.local"
)
Get User Info after authentication
userInfo = lenses_lib.UserInfo()
