python对接身份证核验接口DEMO示例
本文为您提供了python语言版本的运营商二要素(证件号+手机号)对接DEMO示例
运营商二要素(证件号+手机号)接口文档 点击下载
运营商二要素(证件号+手机号)接入指南 点击访问
#接口类型:互亿无线实名认证接口
#账户注册:https://user.ihuyi.com/register.html
#注意事项:
#DEMO仅作参考
#此为python3版本
import requests
import json
import time
import hashlib
#接口地址
url = "https://api.ihuyi.com/idcard/operator2id/Submit.json"
app = "operator2id"
account = "APPID"
password = "APPKEY"
id_card_no = "410XXXXXXXXXXXXXXXXXXX"
mobile = "13600000000"
_now = str(int(time.time()))
password_raw = account + password + app + id_card_no + mobile + _now
# print(password_raw)
password_md5 = hashlib.md5(password_raw.encode(encoding="UTF-8")).hexdigest()
# print(password)
#定义请求的数据
data = {
"app": app,
"account":account,
# "password":password,
"password":password_md5,
"id_card_no":id_card_no,
"mobile":mobile,
"time":_now,
}
#定义请求的头部
headers = {
"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"
}
#发起请求
response = requests.post(url, headers=headers, data=data)
#打印结果
print(response.content.decode())