Great vid, it has been a great help in understanding python and GUI interfaces.
I'm having an issue returning the weather in the label text, it keeps printing none.
def format_response(weather):
name = print(weather['name'])
country = print(weather['sys']['country'])
desc = print(weather['weather'][0]['description'])
temp = print('Temp', weather['main']['temp'])
humidity = print('Humidity', weather['main']['humidity'])
return(str(name) + '' +str(country) + '' + str(desc) + '' + str(temp) + '' + str(humidity))
def get_weather(city):
weather_key = '46a3b3ce2a940322a6965e7e6e433cc1'
url = 'http://api.openweathermap.org/data/2.5/weather?'
params = {'APPID': weather_key, 'q': city, 'units': 'metric'}
response = requests.get(url, params=params)
weather = response.json()
label['text'] = format_response(weather)
that's my code, am I doing anything wrong? your assistance will be appreciated, many thanks.