Last active
April 23, 2016 18:19
-
-
Save dvdme/34bb846055fc78f4bd2d937bcd7cda19 to your computer and use it in GitHub Desktop.
Get weather data from different cities from the past with forecastiopy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from forecastiopy import * | |
apikey = 'YOUR_APY_KEY' | |
Lisbon = [38.7252993, -9.1500364] | |
Madrid = [40.383333, -3.666667] | |
Paris = [48.866667, 2.332778] | |
def print_icon(lat, lon): | |
fio = ForecastIO.ForecastIO(apikey, latitude=lat, longitude=lon) | |
fio.time_url = '2006-12-01T12:00:00-0000' | |
fio.get_forecast(lat,lon) # Be sure to call get_forecast *after* you set the time_url | |
if fio.has_currently() is True: | |
currently = FIOCurrently.FIOCurrently(fio) | |
print currently.icon | |
print currently.temperature | |
else: | |
print 'No Currently data' | |
print_icon(Lisbon[0], Lisbon[1]) | |
print_icon(Madrid[0], Madrid[1]) | |
print_icon(Paris[0], Paris[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment