This repo contains sample code to help you get started with the DrugBank API or your DrugBank portal downloads!
Be sure to check out the documentation:
The sample code uses the following environment variables:
DB_API_KEY
: the API key you use to make API calls, as seen at dev.drugbank.comDB_USER
: the username you use to sign in at portal.drugbank.comDB_PASS
: the password you use to sign in at portal.drugbank.com
NodeJS examples can be found in the nodejs/ folder. These examples do have some external dependencies, which are declared in the package.json file.
One way to experiment with the provided files is to write a script which imports and uses them. All files export their functions and classes for import.
The following example scripts are provided:
api.js
This script contains sample code for making requests to the API, in nodejs.portal.js
This script contains sample code for downloading archives from your portal, and reading drug JSON files in a zip archive.
Python examples can be found in the python/ folder. These examples have been written and tested against python3.
These examples do have some external dependencies, which are declared in the requirements.txt file. To make a virtual environment and install the dependencies, you could run:
python3 -m venv env/
source env/bin/activate
pip install wheel pip # make sure pip is up to date
pip install -r requirements.txt
The following example scripts are provided:
portal.py
This script contains sample code for downloading archives from your portal.