阿里身份证实名认证查询校验接口

萝らか妹 提交于 2019-12-06 10:01:55

阿里身份证实名认证查询校验接口

购买和功能示范地址

python请求验证方法

import urllib, urllib2, sys
import ssl


host = 'https://idenauthen.market.alicloudapi.com'
path = '/idenAuthentication'
method = 'POST'
appcode = '你自己的AppCode'
querys = ''
bodys = {}
url = host + path

bodys['idNo'] = '''340421190210182345'''
bodys['name'] = '''张三'''
post_data = urllib.urlencode(bodys)
request = urllib2.Request(url, post_data)
request.add_header('Authorization', 'APPCODE ' + appcode)
//根据API的要求,定义相对应的Content-Type
request.add_header('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urllib2.urlopen(request, context=ctx)
content = response.read()
if (content):
    print(content)

修改其中的appcode,购买后会给你,每个账号可免费购买十次

请求示例中提供了6种请求方法

成功返回示例

{
  "name": "张三",
  "idNo": "340421190710145412",
  "respMessage": "身份证信息匹配",
  "respCode": "0000",
  "province": "安徽省",
  "city": "淮南市",
  "county": "凤台县",
  "birthday": "19071014",
  "sex": "M",
  "age": "111"
}

失败返回示例

{
  "name": "李四",
  "idNo": "340421190710145412",
  "respMessage": "身份证信息不匹配",
  "respCode": "0008",
  "province": "安徽省",
  "city": "淮南市",
  "county": "凤台县",
  "birthday": "19071014",
  "sex": "M",
  "age": "111"
}

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!