</head> <body> <div class="scrollpanel"> <table class="hourly"> <tr> <th></th> <th></th> <th>Temp (°F)</th> <th>% Hum</th> <th>Precip</th> <th>dewpoint</th> <th>wind</th> </tr>''' #Get the hourly Forecast parsed_json = weather.fetchWeather('hourly10day') # The world has ceased to make sense... if False: print "Nuklear Lunch Codes:" print "N225HSINDX-Twilight" #Loop through the results, and print what is applicable count = 0 for hour in parsed_json['hourly_forecast']: count += 1 print "<tr>" print "<td>" + hour['FCTTIME']['weekday_name'] + "</br>" + hour['FCTTIME'][ 'civil'] + "</td>" print "<td><img class='small' src=" + hour['icon_url'] + " /></td>"
print "Content-Type: text/html;charset=utf-8" print # Print HTML Header print '''<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <meta http-equiv="refresh" content="120;URL=/"> <link rel="stylesheet" type="text/css" href="/css/common.css"> <link rel="stylesheet" type="text/css" href="/css/forecast.css"> </head> <body>''' # Get the week Forecast parsed_json = weather.fetchWeather('forecast10day') # Loop through the results, and print what is applicable count = 0 for day in parsed_json['forecast']['simpleforecast']['forecastday']: count += 1 print "<div class='box' id='box" + str(count) + "'>" print "<span class='larger'>" + day['date']['weekday_short'] + "</span></br>" print "<img class='larger' src=" + day['icon_url'] + " /></br>" print "<span class='larger'>" + str(day['high']['fahrenheit']) + u'° </span> ('.encode('utf-8') + str(day['low']['fahrenheit']) + u'°) </br>'.encode('utf-8') if day['pop'] > 0 and float(day['qpf_allday'][u'in']) > 0: print str(day['pop']) + "% (" + str(day['qpf_allday'][u'in']) + "in)" print "</div>" if count >= 10:
print "Content-Type: text/html;charset=utf-8" print # Print HTML Header print '''<!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <meta http-equiv="refresh" content="120;URL=/"> <link rel="stylesheet" type="text/css" href="/css/common.css"> <link rel="stylesheet" type="text/css" href="/css/forecast.css"> </head> <body>''' # Get the week Forecast parsed_json = weather.fetchWeather('forecast10day') # Loop through the results, and print what is applicable count = 0 for day in parsed_json['forecast']['simpleforecast']['forecastday']: count += 1 print "<div class='box' id='box" + str(count) + "'>" print "<span class='larger'>" + day['date'][ 'weekday_short'] + "</span></br>" print "<img class='larger' src=" + day['icon_url'] + " /></br>" print "<span class='larger'>" + str( day['high']['fahrenheit']) + u'° </span> ('.encode('utf-8') + str( day['low']['fahrenheit']) + u'°) </br>'.encode('utf-8') if day['pop'] > 0 and float(day['qpf_allday'][u'in']) > 0: print str(day['pop']) + "% (" + str(day['qpf_allday'][u'in']) + "in)"
</head> <body> <div class="scrollpanel"> <table class="hourly"> <tr> <th></th> <th></th> <th>Temp (°F)</th> <th>% Hum</th> <th>Precip</th> <th>dewpoint</th> <th>wind</th> </tr>''' #Get the hourly Forecast parsed_json = weather.fetchWeather('hourly10day') # The world has ceased to make sense... if False: print "Nuklear Lunch Codes:" print "N225HSINDX-Twilight" #Loop through the results, and print what is applicable count = 0 for hour in parsed_json['hourly_forecast']: count += 1 print "<tr>" print "<td>" + hour['FCTTIME']['weekday_name'] + "</br>" + hour['FCTTIME']['civil'] + "</td>" print "<td><img class='small' src=" + hour['icon_url'] + " /></td>" print "<td><span class='larger'>" + str(hour['temp']['english']) + u'° </span></td>'.encode('utf-8')