Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,10 @@ def get_weather(city: str) -> str:
|
|
14 |
city: Name of the city (e.g., 'Paris').
|
15 |
"""
|
16 |
try:
|
17 |
-
api_key = "
|
|
|
|
|
|
|
18 |
response = requests.get(
|
19 |
f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
|
20 |
)
|
|
|
14 |
city: Name of the city (e.g., 'Paris').
|
15 |
"""
|
16 |
try:
|
17 |
+
api_key = os.getenv("OPENWEATHERMAP_API_KEY")
|
18 |
+
if not api_key:
|
19 |
+
return "OPENWEATHERMAP_API_KEY key not found"
|
20 |
+
|
21 |
response = requests.get(
|
22 |
f"http://api.openweathermap.org/data/2.5/weather?q={city}&appid={api_key}&units=metric"
|
23 |
)
|