aromidvar1355 commited on
Commit
e223de5
·
verified ·
1 Parent(s): 33c6528

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -30,7 +30,7 @@ data_source = st.sidebar.selectbox(
30
  # --- API CALLING FUNCTIONS ---
31
  def fetch_openweather_data(lat, lon, datetime_input):
32
  """Fetches current weather data from OpenWeather's One Call API."""
33
- timestamp = int(datetime_input.timestamp())
34
  url = f"https://api.openweathermap.org/data/3.0/onecall/timemachine?lat={lat}&lon={lon}&dt={timestamp}&appid={OPENWEATHER_API_KEY}&units=metric"
35
  try:
36
  response = requests.get(url)
 
30
  # --- API CALLING FUNCTIONS ---
31
  def fetch_openweather_data(lat, lon, datetime_input):
32
  """Fetches current weather data from OpenWeather's One Call API."""
33
+ timestamp = int(datetime_input.astimezone(pytz.utc))
34
  url = f"https://api.openweathermap.org/data/3.0/onecall/timemachine?lat={lat}&lon={lon}&dt={timestamp}&appid={OPENWEATHER_API_KEY}&units=metric"
35
  try:
36
  response = requests.get(url)