Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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.
|
| 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)
|