Skip to content

Instantly share code, notes, and snippets.

@wendal
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wendal/3df5030d66d663f946ed to your computer and use it in GitHub Desktop.
Save wendal/3df5030d66d663f946ed to your computer and use it in GitHub Desktop.
快速打印南航的特价票
# -*- coding: UTF-8 -*-
'''
Created on 2014-5-28
快速打印南航的特价票
@author: wendal
'''
import json
import urllib2
import operator
def load(inter=False):
url = "http://eunion.csair.com/E-UNION/data/avprice/getMinPrice.json?inter="
if inter :
url += "Y"
else :
url += "N"
data = str(urllib2.urlopen(url, None, 5).read())[1:-1]
return json.loads(data)["FROMOFLIGHTS"]
if __name__ == '__main__':
for item in load(1) : # 1 国际, 0 国内
print "-----------------------------------------------------------"
print item["DEPCTIYNAME_ZH"], ":"
m = {}
for fly in item["FLIGHT"] :
m[fly["ARRCTIYNAME_ZH"]] = fly["MINPRICE"]
m = sorted(m.iteritems(), key=operator.itemgetter(1))
for v in m :
print "\t", v[0], v[1]
@jacking124
Copy link

要西

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment