身份证查询API

# -*- coding: utf-8 -*-
#python 27
#xiaodeng
#http://apistore.baidu.com/apiworks/servicedetail/113.html
#身份证查询API



import urllib,json,urllib2
#接口地址
url='http://apis.baidu.com/apistore/idservice/id?'#注意问号


#请求方法:GET

#urlParam,url参数
data={'id':'xxxxxx'}#身份证号码
#编码
data=urllib.urlencode(data)
MyUrl=url+data


#header,头部信息
#记住添加头部信息的方法
req=urllib2.Request(MyUrl)
req.add_header('apikey','75ea5c11d0461f15791c1398a05369b7')
resp=urllib2.urlopen(req)
content=resp.read()
content=eval(content)
print content.values()

 

posted @ 2015-10-23 21:20  Xiao|Deng  阅读(1361)  评论(1编辑  收藏  举报