Spaces:
Sleeping
Sleeping
Committing before cloning repo
Browse files
tools/nasa_neo_data_fetcher.py
CHANGED
@@ -10,14 +10,14 @@ 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 |
try:
|
17 |
-
get_data = get_nasa_neo_data(
|
18 |
except Error:
|
19 |
-
get_data = fetch_neo_data_in_chunks(
|
20 |
-
data = get_data(
|
21 |
|
22 |
|
23 |
def forward(self, query):
|
@@ -40,6 +40,7 @@ class NASANeoDataFetcher(Tool):
|
|
40 |
data = response.json()
|
41 |
return data
|
42 |
else:
|
|
|
43 |
print("Error: ", response.status_code)
|
44 |
|
45 |
def split_month_into_chunks(self, year: int, month: int) -> list:
|
|
|
10 |
inputs = {'query': {'type': 'string', 'description': 'The range of dates to query.'}}
|
11 |
output_type = "string"
|
12 |
|
13 |
+
def __init__(self, query):
|
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 = self.get_nasa_neo_data(query)
|
18 |
except Error:
|
19 |
+
get_data = self.fetch_neo_data_in_chunks(query)
|
20 |
+
data = get_data(query)
|
21 |
|
22 |
|
23 |
def forward(self, query):
|
|
|
40 |
data = response.json()
|
41 |
return data
|
42 |
else:
|
43 |
+
fetch_neo_data_in_chunks(start_date, end_date)
|
44 |
print("Error: ", response.status_code)
|
45 |
|
46 |
def split_month_into_chunks(self, year: int, month: int) -> list:
|