Spaces:
Runtime error
Runtime error
| import requests | |
| def get_weather(city): | |
| """Fetch real-time weather from wttr.in""" | |
| url = f"https://wttr.in/{city}?format=%C+%t" | |
| try: | |
| response = requests.get(url).text | |
| return f"Hali ya hewa katika {city}: {response}" | |
| except Exception: | |
| return "Samahani, siwezi kupata hali ya hewa kwa sasa." | |