5.0

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 NameDescription
basic BasicAuthentication (Accont)
serviceService Account (Token Based)
krb5Kerberos Authentication

Basic authentication

Parameter NameDescriptionRequiredType
auth_typeAuthentication TypeYesString
urlLenses EndpointYesString
usernameUsernameYesString
passwordPasswordYesString

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 NameDescriptionRequiredType
auth_typeAuthenticationTypeYes
urlLenses EndpointYesString
krb_service ServiceYesString


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()