To install the openlab python client, ensure you have python >= 3.6, which comes packaged with the python package installer (pip). To check the version, open a command prompt and type your python environmental variable (in my case, it was customized to
py) and followed by
Once you have verified your python version, simply run
pip install openlab in the command prompt.
This will fetch the openlab package, and download all necessary python dependencies if they aren't installed yet.
Note: If you get a
PermissionError like the following, try adding
--user t0 the previous command to install the package without adminstrative rights.
Setup your OpenLab credentials
Either create a new python script, or open a python shell (following method). The first time you initialize and run
openlab.http_client(), you will be prompted to enter the following credentials:
- Username (make sure it is exactly how it appears in OpenLab)
- Api Key (see below for instructions)
To generate an api key, go to your
User settings in the top right corner of https://live.openlab.app and click
Generate API Key.
A new api key will be generated, and a form should appear which will overwrite your old api key (if you had one). Copy this key and paste it into the python prompt.
After you have entered this, the python client will store it in your password keychain, and you will not need to input these afterwards (unless you generate a new api key).
Note: If you need to switch users or change api key, enter and run
openlab.login.switch_user(new_username, new_api_key) from a python script/shell.
If you have any questions or problems authenticating the openlab python client, please don't hestitate to contact us!