drug data api
https://SubstanceSearch.org
- Python 94.3%
- Dockerfile 4.9%
- Shell 0.8%
| .github | fix: change secret name to not conflict with GitHub | |
| data | data: update datamed artifact | |
| src | rewrite to api | |
| tests | fix: ci app-test | |
| .dockerignore | rewrite to api | |
| .gitignore | feat: add unit test workflow | |
| app.py | rewrite to api | |
| docker-compose.yml | fix port mapping to localhost | |
| Dockerfile | misc: switch prod to 8080 | |
| README.md | misc: switch prod to 8080 | |
| requirements.txt | rewrite to api | |
| start.sh | misc: switch prod to 8080 | |
harm reduction api for substance information
quick start
with docker (recommended)
# build and run
docker-compose up --build
# or run in background
docker-compose up -d --build
api will be available at http://localhost:8080
without docker
# install python 3.7+
pip install -r requirements.txt
# run
python app.py
api endpoints
GET /- api documentationGET /api/substance/{slug}- get substance data from all sourcesGET /api/substance/{slug}/sources/{source}- get substance data from specific source
examples
# get lsd data
curl http://localhost:8080/api/substance/lsd
# get lsd data from tripsit only
curl http://localhost:8080/api/substance/lsd/sources/tripsit
# get api docs
curl http://localhost:8080/
data sources
- tripsit - community harm reduction database
- psychonautwiki - research-based substance info
production
the docker setup includes:
- gunicorn wsgi server
- health checks
- non-root user
- optimized for production