28 lines
675 B
Python
28 lines
675 B
Python
# gaiaapiclient/cone_search.py
|
|
# send an api request with the coordinates and search radius in decimal degrees
|
|
# to the GaiaDBInterface server to fetch the GAIA sources
|
|
|
|
|
|
import requests
|
|
|
|
|
|
def query(ra, dec, radius, order):
|
|
url = "http://localhost:8000/gaiadb/cone_search"
|
|
params = {
|
|
'ra' : ra,
|
|
'dec' : dec,
|
|
'radius' : radius,
|
|
'order' : order
|
|
}
|
|
response = requests.get(url, params=params)
|
|
response.raise_for_status()
|
|
try:
|
|
data = response.json() if response.text else None
|
|
except ValueError as json_err:
|
|
print(f"JSON decode error occurred: {json_err}")
|
|
data = None
|
|
|
|
|
|
return data
|
|
|