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
Using the token
The following code is required to add the authentication function in the Polly Python library
AUTH_TOKEN = "[authentication_token_copied]"
Polly.auth(AUTH_TOKEN)
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:-
AUTH_KEY = "[authentication_key_copied]"
Polly.auth(AUTH_KEY)
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,
omixatlas = OmixAtlas()
output = omixatlas.[function()]
Similarly, for functions related to Workspaces,
workspaces = Workspaces()
output = workspaces.[function()]
And, for functions related to Cohorts,
cohort = Cohort()
output = cohort.[function()]