• {{tutorialGroup.label}}
  • {{tutorial.label}} {{tutorial.label}}
.tar.gz {{dependency.name}} .ipynb Version










Documentation not found. Please change the API version for a more recent version.









DACE Python API

Introduction

The Python DACE client API goal is to query DACE backend via a simple python client.

Installation

The lib can be installed using pip utility:

pip install python-dace-client
For future upgrades:

pip install python-dace-client --upgrade

Authentication

If you need to be authentified when querying some services, you'll have to create a .dacerc file in your home directory. Then fill it with this example :

[user]
  key = apiKey:Your API key here
To generate an API key, go to DACE website and log in. Then go to Profile and Generate a new API key. You can finally copy/paste the key into your .dacerc file or directly download the .dacerc file.

Contact

If you have questions, please contact DACE-support

Filters and Sorting

When using the API you will find often filters and sorting possibility. See example :

exoplanet_data = Exoplanet.query_database(filters={'db_info_name':{'contains':'Exoplanets.org'}} , sort={'db_info_name':'asc'})

In this example, a filter is set on column 'db_info_name' containing 'Exoplanets.org' and ascending sorted (sort={'db_info_name': 'asc'})

See below the possibilities for filters and sorting

Filters

It depends the column type


Float

min, max.

Example :
filters={'obj_mag_v':{'min':0.0, 'max':10.0}

String

'empty':True/False, 'contains':'...', 'notContains':'...'

Example :
filters={'obj_id_catname':{'contains':'HD', 'notContains':'WASP', 'empty':False}}
You can use one, two or the three options at the same time
contains and notContains can be string or array of strings

Int

equal or min, max

filters={'prog_type':{'min':0, 'max':10} or filters={'prog_type':{'equal':10}

Boolean

'is' : True/False

filters={'db_lc_available':{'is':True}}

Sorting

You can sort by any column in ascending or descending like this :

Ascending

sort={'db_info_name': 'asc'}

Descending

sort={'db_info_name': 'desc'}