Last night and this morning has seen a little bit of snow across Manchester (UK), spurring me on to create my weather checker in Python.
I am making use of the open API that http://openweathermap.org provides and having signed up for a free API key I’ve got straight into creating a Python program.
Things to do:
– Get it to ask for user location input as Open Weather Map can search on locations
– Get it to display a small graphic (e.g. snow flakes) for the first forecast
– Get it to ask user for how many forecasts they want to see (e.g. 3 instead of 10, this would cover a 9hr window of weather)
#print weather location for Manchester, UK
#imports required modules
import json, requests
#calls on the API of openweathermap.org
#ID is for Manchester, see http://openweathermap.org/api for an APPID(API KEY)
#Loads the JSON
print(“Weather for Manchester, UK”)
#Cycles through the next 10 3hr blocks which is roughly the next 30hrs
for x in weather:
#Converts F into C, as I’m more of a celsius person
print(‘Average temp in Celsius:’,temp_c)
One thought on “Weather Forecast V1 (Python)”
Comments are closed.