quick commit

This commit is contained in:
2024-09-19 10:49:14 +03:00
parent 4121e2adfe
commit 4267468288
3 changed files with 22 additions and 32 deletions

View File

@@ -6,21 +6,22 @@
import requests
def query(ra, dec, radius):
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:
response.raise_for_status() # Ensure this is a method call
print(response.text) # Print the raw response text
return response.text # Return the raw response text
except requests.exceptions.HTTPError as http_err:
print(f"HTTP error occurred: {http_err}")
return None
except requests.exceptions.RequestException as req_err:
print(f"Request error occurred: {req_err}")
return None
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