kevindiependaele commited on
Commit
16aecb0
·
1 Parent(s): 4a5001f

epocs to datetimes

Browse files
Files changed (1) hide show
  1. tools/weather_api.py +7 -9
tools/weather_api.py CHANGED
@@ -49,15 +49,13 @@ 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
- # if date in day["dt"]:
58
- # weather = day["weather"][0]["description"]
59
- # temperature = day["temp"]["day"]
60
- # return f"The weather in {location} on {date} is {weather} with a temperature of {temperature}°C."
61
 
62
  return weather_data
63
 
 
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
+ print(date_time.strftime('%Y-%m-%d %H:%M:%S'))
 
 
59
 
60
  return weather_data
61