Getting Started
Install Polly Python using pip
pip install polly-python
Import from libraries
The following libraries need to be imported over the development environment to access the data.
from polly.auth import Polly
from polly.omixatlas import OmixAtlas
from polly.workspaces import Workspaces
from polly.cohort import Cohort
Authentication
Authentication of the account is required to be able to access the capabilities of the Polly Python library.
Using auto-generated tokens (recommended)
Run this code to automatically authenticate.
import os
from polly.auth import Polly
AUTH_TOKEN = (os.environ['POLLY_REFRESH_TOKEN'])
Polly.auth(AUTH_TOKEN)
Copying authentication token or key
To get this token, follow the steps below:
-
Go to Polly
-
Click the User Options icon from the left-most panel
-
Click on Authentication on the panel that appears
-
Click on Copy to copy the authentication token or key
There are two ways to authenticate to Polly, using TOKENS
(expires in 30 days) and using API KEYS
(doesn't expire). While using Polly Notebooks, users can just use POLLY_REFRESH_TOKEN instead of having to copy the token from Authentication panel. This is further described below.
Using the token
The following code is required to add the authentication function in the Polly Python library
Using the key
Go to authentication keys and input the name, description to generate a key. This can be copied and used as shown below:-
Calling a function
In order to call a functions from a particular class, corresponding object should be defined.
E.g. for functions related to OmixAtlas,
Similarly, for functions related to Workspaces, And, for functions related to Cohorts,For example,