FuturesonyAi / weather.py
Futuresony's picture
Create weather.py
713bdd2 verified
raw
history blame contribute delete
338 Bytes
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."