Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,7 +20,7 @@ def get_weather(city: str) -> str:
|
|
| 20 |
"""
|
| 21 |
try:
|
| 22 |
|
| 23 |
-
url = f"https://wttr.in/{city}?format=%C+%t+%h+%w&m&lang=
|
| 24 |
response = requests.get(url, timeout=10)
|
| 25 |
|
| 26 |
if response.status_code == 200 and response.text.strip():
|
|
@@ -28,11 +28,11 @@ def get_weather(city: str) -> str:
|
|
| 28 |
|
| 29 |
if '°F' in data:
|
| 30 |
data = data.replace('°F', '°C')
|
| 31 |
-
return f"
|
| 32 |
-
return f"
|
| 33 |
|
| 34 |
except Exception as e:
|
| 35 |
-
return f"
|
| 36 |
|
| 37 |
|
| 38 |
@tool
|
|
|
|
| 20 |
"""
|
| 21 |
try:
|
| 22 |
|
| 23 |
+
url = f"https://wttr.in/{city}?format=%C+%t+%h+%w&m&lang=en"
|
| 24 |
response = requests.get(url, timeout=10)
|
| 25 |
|
| 26 |
if response.status_code == 200 and response.text.strip():
|
|
|
|
| 28 |
|
| 29 |
if '°F' in data:
|
| 30 |
data = data.replace('°F', '°C')
|
| 31 |
+
return f"Weather in city: {city}:\n{data}"
|
| 32 |
+
return f"Data about weather in city {city} temporary unavailable."
|
| 33 |
|
| 34 |
except Exception as e:
|
| 35 |
+
return f"Error: {str(e)}"
|
| 36 |
|
| 37 |
|
| 38 |
@tool
|