Configure Your Environment
Let's get your local environment ready to use the API.
The config file is saved in ~/.scienceio/config
. The [SETTINGS]
within the file should include the key_id
andkey_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).
Important
Make 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 scio
object.
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_ID
and 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.
You can then make your first API call in Python.
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 scienceio
command 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.
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
/Users/{username}
- Linux users, your home directory is
/home/{username}
- Windows users, your home directory is
C:\Users\{username}
- Add a new config file that contains:
[SETTINGS]
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:
cat ~/.scienceio/config
You can then make your first API call via HTTP.
Updated 12 days ago