import getmetar from cgi import parse_qs def application(env, start_response): d = parse_qs(env['QUERY_STRING']) try: station = d.get('station', '')[0] except: station = "" #start_response('200 OK', [('Content-Type', 'text/plain')]) # return str.encode(station) metar = "" if station == "": metar = getmetar.extract_metar("UKBB") else: metar = getmetar.extract_metar(station.upper()) html = "" html += "
" html += "" html += "" html += "" html += metar + "