Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import requests
|
|
| 4 |
from bs4 import BeautifulSoup
|
| 5 |
import os
|
| 6 |
import statistics
|
|
|
|
| 7 |
|
| 8 |
# OpenAI API Key aus Umgebungsvariablen
|
| 9 |
openai.api_key = os.getenv('OPENAI_API_KEY')
|
|
@@ -12,7 +13,8 @@ openai.api_key = os.getenv('OPENAI_API_KEY')
|
|
| 12 |
def get_hourly_weather_data(lat, lon):
|
| 13 |
api_key = os.getenv('WEATHER_API_KEY')
|
| 14 |
base_url = "http://api.openweathermap.org/data/2.5/forecast?"
|
| 15 |
-
|
|
|
|
| 16 |
response = requests.get(complete_url)
|
| 17 |
if response.status_code == 200:
|
| 18 |
return response.json()
|
|
|
|
| 4 |
from bs4 import BeautifulSoup
|
| 5 |
import os
|
| 6 |
import statistics
|
| 7 |
+
from datetime import datetime
|
| 8 |
|
| 9 |
# OpenAI API Key aus Umgebungsvariablen
|
| 10 |
openai.api_key = os.getenv('OPENAI_API_KEY')
|
|
|
|
| 13 |
def get_hourly_weather_data(lat, lon):
|
| 14 |
api_key = os.getenv('WEATHER_API_KEY')
|
| 15 |
base_url = "http://api.openweathermap.org/data/2.5/forecast?"
|
| 16 |
+
# Adding a cache-busting parameter with the current timestamp
|
| 17 |
+
complete_url = f"{base_url}lat={lat}&lon={lon}&appid={api_key}&units=metric&lang=de&_={datetime.now().timestamp()}"
|
| 18 |
response = requests.get(complete_url)
|
| 19 |
if response.status_code == 200:
|
| 20 |
return response.json()
|