Spaces:
Sleeping
Sleeping
kevindiependaele commited on
Commit ·
afa002b
1
Parent(s): 16aecb0
day selection
Browse files- tools/weather_api.py +3 -6
tools/weather_api.py
CHANGED
|
@@ -49,13 +49,10 @@ class WeatherApiTool(Tool):
|
|
| 49 |
weather_data["state"] = state
|
| 50 |
|
| 51 |
# Extract the weather data for the specified date
|
| 52 |
-
# date_obj = datetime.strptime(date, "%Y-%m-%d")
|
| 53 |
-
# date_obj = self.local_tz.localize(date_obj)
|
| 54 |
-
# epoch = date_obj.timestamp()
|
| 55 |
-
# print(f"Epoch: {epoch}")
|
| 56 |
for day in weather_data["daily"]:
|
| 57 |
date_time = datetime.fromtimestamp(day["dt"])
|
| 58 |
-
|
|
|
|
| 59 |
|
| 60 |
-
return
|
| 61 |
|
|
|
|
| 49 |
weather_data["state"] = state
|
| 50 |
|
| 51 |
# Extract the weather data for the specified date
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
for day in weather_data["daily"]:
|
| 53 |
date_time = datetime.fromtimestamp(day["dt"])
|
| 54 |
+
if date_time.strftime('%Y-%m-%d') == date:
|
| 55 |
+
break
|
| 56 |
|
| 57 |
+
return day
|
| 58 |
|