Spaces:
Sleeping
Sleeping
Added forward function
Browse files
tools/nasa_neo_data_fetcher.py
CHANGED
@@ -10,9 +10,20 @@ class NASANeoDataFetcher(Tool):
|
|
10 |
inputs = {'query': {'type': 'string', 'description': 'The range of dates to query.'}}
|
11 |
output_type = "string"
|
12 |
|
13 |
-
def __init__(self):
|
14 |
self.api_key = os.getenv("NASA_API_KEY")
|
15 |
self.root_url = "https://api.nasa.gov/neo/rest/v1/feed?"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
|
17 |
def get_nasa_neo_data(self, start_date: str, end_date: str) -> dict:
|
18 |
"""A function to get Near Earth Object data from NASA API. Try this function first before
|
|
|
10 |
inputs = {'query': {'type': 'string', 'description': 'The range of dates to query.'}}
|
11 |
output_type = "string"
|
12 |
|
13 |
+
def __init__(self, kwargs**):
|
14 |
self.api_key = os.getenv("NASA_API_KEY")
|
15 |
self.root_url = "https://api.nasa.gov/neo/rest/v1/feed?"
|
16 |
+
try:
|
17 |
+
get_data = get_nasa_neo_data(kwargs**)
|
18 |
+
except Error:
|
19 |
+
get_data = fetch_neo_data_in_chunks(kwargs**)
|
20 |
+
data = get_data(kwargs**)
|
21 |
+
|
22 |
+
|
23 |
+
def forward(self, query):
|
24 |
+
results = self.data(query)
|
25 |
+
return results
|
26 |
+
|
27 |
|
28 |
def get_nasa_neo_data(self, start_date: str, end_date: str) -> dict:
|
29 |
"""A function to get Near Earth Object data from NASA API. Try this function first before
|