#!/usr/bin/python # encoding:utf-8 import urllib2, json, urllib # 3、查询违章 data = {} appkey = "your_appkey_here" data["carorg"] = "" #交管局代号 data["lsprefix"] = "京" #车牌前缀 utf8 data["lsnum"] = "" #车牌 data["lstype"] = "02" #车辆类型 data["engineno"] = "" #发动机号 data["frameno"] = "" #车架号 url_values = urllib.urlencode(data) url = "https://api.jisuapi.com/licenseplate/verify?appkey=" + appkey request = urllib2.Request(url,url_values) result = urllib2.urlopen(request) jsonarr = json.loads(result.read()) if jsonarr["status"] != u"0": print jsonarr["msg"] exit() result = jsonarr["result"] if result["verifystatus"] == 0: print result["verifymsg"] + " 违章总条数:" + result["illegalnum"] + " 本省违章条数:" + result["illegalnumlocal"] + " 外省违章条数:" + result["illegalnumother"] #校验成功 else: print result["verifymsg"]