weather reporter with python

Solutions on MaxInterview for weather reporter with python by the best coders in the world

showing results for - "weather reporter with python"
Nele
18 Jan 2018
1import time
2import requests
3from pprint import pprint
4
5try:
6    
7    Api_key = "Your api key"
8    city_or_country = str(input('Write a "city" or "Country" name for which you want the weather:- '))
9    print("Fetching Data of",city_or_country)
10    time.sleep(4)
11    URL = "https://api.openweathermap.org./data/2.5/weather?appid=" + Api_key + "&q="+ city_or_country
12    weather_data = requests.get(URL).json()
13    pprint(weather_data)
14except ValueError:
15    print("incorrect input or API KEY")