互亿无线 · 文档中心

运营商二要素 - 代码示例


python对接身份证核验接口DEMO示例
本文为您提供了pyhon语言版本的运营商二要素核验对接DEMO示例

运营商二要素接口文档 点击下载

运营商二要素接入指南 点击访问

#接口类型:互亿无线实名认证接口
#账户注册:https://user.ihuyi.com/register.html
#注意事项:
#DEMO仅作参考
#此为python3版本

#测试环境:win10 python3.10.2 pip21.3.1 requests-2.27.1
#类库安装:进入python安装目录执行 pip install requests

import requests
import json
import time
import hashlib

#接口地址
url = 'https://api.ihuyi.com/idcard/Submit.json'

account = 'APPID'
password = 'APPKEY'
app = 'oper2' #固定值
name = '张三'
mobile = '13600000000'
_now = str(int(time.time()))
password_raw = account + password + app + name + mobile + _now
# print(password_raw)
password_md5 = hashlib.md5(password_raw.encode(encoding='UTF-8')).hexdigest()
# print(password)

#定义请求的数据
data = {
    'account':account,
    # 'password':password,
    'password':password_md5,
    'app':app,
    'name':name,
    '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())

现在注册,即享新用户礼包!

在线咨询
电话咨询

服务热线:

4008 808 898

服务热线(工作时间):

4008 808 898

业务咨询(非工作时间):

4008 808 898

售后咨询(非工作时间):

4008 808 898

验证码已发送到您的手机,请查收!

填写验证码后,点击“开通体验账户”自动开通体验账户。

收不到短信验证码?
×