Skip to main content

Client for Open Targets REST API at

Project description


Python client for the Open Targets REST API at Build Status Documentation Status

Why should you use this client instead of the REST API directly?

  • Include wrappers for all public methods, with query validation
  • Tools for the most common calls (E.g. get data for a target gene symbol even if you do not know its Ensembl Gene Id)
  • Supports automatic retrieval of paginated results with an iterator pattern
  • Easily save query results as JSON, CSV or Excel file
  • Handles Authentication
  • Handles fair usage limits transparently
  • Follows HTTP cache as set by the REST API
  • Experimental HTTP2 support for better performance (beware the client library is in alpha)
  • Support for advanced SSL and proxy configuration

This client is supported for Python 3.5 and upper. Works on pythoon 2.7 on a best effort basis.

Documentation is available on ReadTheDocs


from opentargets import OpenTargetsClient

ot = OpenTargetsClient()

search_result ='BRAF')

a_for_target = ot.get_associations_for_target('BRAF')
for a in a_for_target:
    print(a['id'], a['association_score']['overall'])

a_for_disease = ot.get_associations_for_disease('cancer')


e_for_target = ot.get_evidence_for_target('BRAF')

e_for_disease = ot.get_evidence_for_disease('medulloblastoma')





To create a development environment:

git clone <this repo>
cd opentargets-py
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt

How to contribute:

  1. (if you are not part of the open targets team) fork the repo
  2. branch from master, always start with git checkout -b yourname-featureyouareadding
  3. code
  4. push your branch and submit a PR
  5. ask for reviews for your PR
  6. Travis tests have to pass
  7. Your PR is approved and merged

How to release

  1. Draft a new release
  2. add a tag using semantic versioning, pointing to master
  3. Press publish

Releases will automatically deploy to pypi (thanks to travis) once they are created in the github console.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for opentargets, version 3.1.16
Filename, size File type Python version Upload date Hashes
Filename, size opentargets-3.1.16-py2.py3-none-any.whl (12.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page