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

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

购买和功能示范地址

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"
}

猜你喜欢

转载自www.cnblogs.com/Strangers/p/11924737.html
今日推荐