Spaces:
Sleeping
Sleeping
kevindiependaele commited on
Commit ·
baa37e5
1
Parent(s): 0818c89
date selection test
Browse files- tools/weather_api.py +6 -1
tools/weather_api.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import os
|
| 2 |
from typing import Dict
|
|
|
|
| 3 |
|
| 4 |
from smolagents.tools import Tool
|
| 5 |
|
|
@@ -43,7 +44,11 @@ class WeatherApiTool(Tool):
|
|
| 43 |
weather_data["country"] = country
|
| 44 |
weather_data["state"] = state
|
| 45 |
|
| 46 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
# for day in weather_data["daily"]:
|
| 48 |
# if date in day["dt"]:
|
| 49 |
# weather = day["weather"][0]["description"]
|
|
|
|
| 1 |
import os
|
| 2 |
from typing import Dict
|
| 3 |
+
from datetime import datetime
|
| 4 |
|
| 5 |
from smolagents.tools import Tool
|
| 6 |
|
|
|
|
| 44 |
weather_data["country"] = country
|
| 45 |
weather_data["state"] = state
|
| 46 |
|
| 47 |
+
# Extract the weather data for the specified date
|
| 48 |
+
date_obj = datetime.strptime(date, "%Y-%m-%d")
|
| 49 |
+
date_obj = date_obj.replace(tzinfo="Europe/Brussels")
|
| 50 |
+
epoch = date_obj.timestamp()
|
| 51 |
+
print(f"Epoch: {epoch}")
|
| 52 |
# for day in weather_data["daily"]:
|
| 53 |
# if date in day["dt"]:
|
| 54 |
# weather = day["weather"][0]["description"]
|