def main():
global args
args = parse_arguments()
last_sync = ""
if not args.all:
now = datetime.now()
last_sync = (now - timedelta(hours=3)).strftime("%Y-%m-%d %H:%M:%S")
last_sync = urllib.quote_plus(last_sync)
connection = httplib.HTTPConnection(WSHOST, 80)
uri = WSURI % last_sync
connection.request("GET", uri)
response = connection.getresponse()
if response.status != httplib.OK:
logging.error("The webservice didn't return OK :(")
return 1
json = response.read()
data = anyjson.deserialize(json)
departures = fetch_departures(data)
cgitb.enable()
table = PrettyTable(['Scheduled',
'Expected', 'Destination',
'Flight', 'Airline', 'Gate',
'Aircraft', 'Reg', 'Status'])
table.align = 'l'
for departure in sorted(departures):
table.add_row(departure)
print table
return 0
评论列表
文章目录