The dace-query lets easily query DACE and access public and private data using a simple utility tool.
Project description
Description
The dace-query lets easily query DACE and access public and private data using a simple utility tool.
Installation
The dace-query is available on PyPi and can be installed using pip or conda:
# Install using pip
pip install dace-query
# Update using pip
pip install dace-query --upgrade
# Install using conda
# First, create a conda environment
conda create -n <env_name> python=3.9 # python version equal or upper than 3.9
# Second, activate the environment
conda activate <env_name>
# Finally, install using anaconda pip
pip install dace-query
Make sure the API is installed correctly :
# Import dace
import dace_query
# List content of the dace package
help(dace)
Authentication
In order to access the private data of DACE, an authentication system has been implemented. This one works very simply, it just requires three things detailed in the following subsections:
A DACE account
An API key
A local .dacerc file
1. Create an account
Register on the DACE web portal with a university email address.
2. Generate the DACE API key
To obtain an API key:
Login on DACE (https://dace.unige.ch)
Go to the user profile
Click on [Generate a new API key]
Copy this new API key into the .dacerc file
3. The .dacerc file
The .dacerc file, (you have to create it), located by default in the home directory (~/.dacerc) and in TOML format, defines a user section with a key-value pair specifying the user’s API key (see below).
[user]
key = apiKey:<xxx-xxx-xxx>
For example, if your API key is 12345678-1234-5678-1234-567812345678, then the .dacerc file will be :
[user]
key = apiKey:12345678-1234-5678-1234-567812345678
To create the .dacerc file on Linux or macOs, open a terminal window and type :
printf '[user]\nkey = apiKey:%s\n' "your-api-key-here" > ~/.dacerc
Quickstart
# Import the ready-to-use exoplanet instance
from dace_query.exoplanet import Exoplanet
# Retrieve data from the exoplanet database
result: dict = Exoplanet.query_database(limit=10, output_format='dict')
# Get the planet names
planet_names: list = result.get('obj_id_catname')
# Print the planet names
print(planet_names)
For more examples of uses, such as filtering bad quality data (see Usage examples)
Contact
In case of questions, proposals or problems, feel free to contact the DACE support .
Links
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for dace_query-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72c29598a4327115a1c0da67c2e95dc4cc993f51bdb9d0bc030841f6098428f2 |
|
MD5 | 6eed2fcb961b6056fee0e3708753de15 |
|
BLAKE2b-256 | ee5e1abf3ff3cb6733cc99b7929286be6d50722066f9ac00367534409d624e9e |