Skip to content

Instantly share code, notes, and snippets.

@denolayanbule
Created November 23, 2017 23:21
Show Gist options
  • Save denolayanbule/821790c25e7bdd699f8d4c4c6157df71 to your computer and use it in GitHub Desktop.
Save denolayanbule/821790c25e7bdd699f8d4c4c6157df71 to your computer and use it in GitHub Desktop.
import requests
#Allows us to take the city name from the user
city = input('Which city would you like to know the weather for ?: ')
url = "http://api.openweathermap.org/data/2.5/weather?appid=fc121d2e5a701f5309e46aa3e75cb8eb&q=" + city
json_data = requests.get(url).json()
#print(json_data)
formatted_data = json_data["weather"][0]['main']
print(formatted_data.upper())
print("Thank you for using the weather API")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment