Configure Your Environment
The config file is saved in
[SETTINGS] within the file should include the
key_secret. It should look like this:
# make sure you do NOT have quotes (single or double) around your API keys [SETTINGS] key_id = ABCDEFGHIJK123456789 key_secret = 2a384c12-df4c-4ee4-a14c-7762e8e9dcf3
See below for more detailed instructions on setting up the config file, including automatic setup (Method 1).
ImportantMake sure you have signed up for a ScienceIO account and gotten your API keys before configuring your environment. For help with this, see Get API Keys.
Method 1: IPython or Jupyter Notebook
First, install the ScienceIO Python package using
pip. Make sure you are using Python v3.7 or above.
pip install scienceio
Next, run the following code to import the
ScienceIO library and create a
from scienceio import ScienceIO scio = ScienceIO()
The first time you use this code in IPython or a Jupyter notebook, you will automatically be prompted to input the
API_KEY_SECRET, which will then be saved in
~/.scienceio/config. This will happen once unless you open a new notebook; you will not be prompted again later if you update the SDK to a newer version.
Hosted EnvironmentUsers who are unable to edit the config file may choose to leverage environment variables to hold their API keys (see this Python environment post or this Jupyter notebook post for help) in lieu of the automatic prompting for keys. This can help make the process of editing or updating keys easier for these types of users.
Method 2: Terminal
If you do not plan to use IPython or a Jupyter notebook, you can configure the API manually.
- Create a new directory called .scienceio in your home directory.
- Mac users, your home directory is
- Linux users, your home directory is
- Windows users, your home directory is
- Add a new config file that contains:
key_id= (your API Key ID)
key_secret= (your API Secret Key)
You can use the following code in Terminal to achieve this:
cd ~ mkdir .scienceio cd .scienceio touch config echo "[SETTINGS]" >> config echo "key_id = <YOUR_API_KEY_ID>" >> config echo "key_secret = <YOUR_API_SECRET_KEY>" >> config
For Mac & Linux users, you can check your config file by running the following command:
- If you are getting a ModuleNotFoundError, make sure you have installed the ScienceIO Python Package within the tool and/or notebook you are using. You may do this via the UI of some editors by searching for and adding the scienceio package, or by using the
pip install scienceiocommand within the notebook.
- If you are not automatically prompted for your API keys, try again in a new notebook. If the issue persists, delete the config file and try again.
- If you are using a hosted notebook and experience a problem, and have not used environment variables for your API keys, try uninstalling scienceio, restarting your runtime, and trying the config process again.
Was this page helpful?
Great! If you ever have questions or want to provide feedback, send us an email.
Bummer. We hate when we miss the mark. If you have suggestions for improvements or other general comments, send us an email.