# -*- coding: utf-8 -*-#python 27#xiaodeng#http://apistore.baidu.com/apiworks/servicedetail/113.html#身份证查询APIimport 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()