You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
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><head><meta http-equiv=\"refresh\" content=\"600\" />"
|
|
html += "<style type=\"text/css\">"
|
|
html += "body { font-size: 20px; font-family: Ubuntu, Verdana; color: #FFFFFF; }"
|
|
html += "</style>"
|
|
html += "</head>"
|
|
html += "<body>"
|
|
html += metar + "<br>"
|
|
html += "</body></html>"
|
|
start_response('200 OK', [('Content-Type', 'text/html'), ('Content-Length', str(len(html)))])
|
|
|
|
return str.encode(html)
|
|
|
|
def empty_func(a,b):
|
|
return None
|
|
|
|
|
|
if __name__ == "__main__":
|
|
x = None
|
|
y = empty_func
|
|
print(application(x,y))
|