Openweathermapapi
https://api.openweathermap.org/data/2.5/weather?lat=35.68&lon=139.76&appid=YOUR_API_KEY import requests API_KEY = "your_api_key_here" city = "Tokyo" url = f"http://api.openweathermap.org/data/2.5/weather?q=city&appid=API_KEY&units=metric"
response = requests.get(url) data = response.json() openweathermapapi
if response.status_code == 200: print(f"City: data['name']") print(f"Temperature: data['main']['temp']°C") print(f"Weather: data['weather'][0]['description']") else: print(f"Error data['cod']: data['message']") OpenWeatherMap offers several tiers. All plans are pay-as-you-grow : https://api
"coord": "lon": -122.08, "lat": 37.39 , "weather": [ "id": 800, "main": "Clear", "description": "clear sky", "icon": "01d" ], "main": "temp": 282.55, "feels_like": 281.86, "temp_min": 280.37, "temp_max": 284.26, "pressure": 1023, "humidity": 100 , "wind": "speed": 1.5, "deg": 350 , "dt": 1560350645, "sys": "country": "US", "sunrise": 1560343627, "sunset": 1560396563 , "timezone": -25200, "name": "Mountain View" "weather": [ "id": 800