#!/usr/bin/python # encoding:utf-8 import urllib2, json, urllib dict ={} dict['key'] = '您申请的key,在会员中心->我的数据->对应数据的下方'; dict['com'] = '小米科技有限责任公司'; dict['year'] = '2016'; url = "http://v.1dq.com/api/c102 + "?" + urllib.urlencode(dict) result = urllib2.urlopen(urllib2.Request(url)) jsonarr = json.loads(result.read()) # 输出错误码 print jsonarr["error_code"]