-
银行卡号实名认证(二要素)
[Python]- https://www.6api.net/api/bankcardverify/
- 阅读数:22991 上传时间:2020-11-21
- 示例代码
本代码示例是基于Python的六派数据接口进行数据请求 API服务请求的代码示例,使用前你需要:
①:通过https://www.6api.net/api/bankcardverify/ 申请API服务
以下是完整代码示例:
#!/usr/bin/env python # -*- coding: utf-8 -*- # 测试环境: python2.7 # 安装requests依赖 => pip install requests/ easy_install requests import requests import json import sys reload(sys) sys.setdefaultencoding("utf-8") def api_send_request(method, url, params=None, headers=None): ''' 转发请求到目的主机 @param method str 请求方法 @param url str 请求地址 @param params dict 请求参数 @param headers dict 请求头 ''' method = str.upper(method) if method == "POST": return requests.post(url=url, data=params, headers=headers) elif method == "GET": return requests.get(url=url, params=params, headers=headers) else: return None method = "POST" url = "http://open.liupai.net/bankcardverify" headers = None params = { "appkey" : "yourappsecret", "idcard" : "参数1", "realname" : "参数2" } result = api_send_request(method=method, url=url, params=params, headers=headers) if result: body = result.result response = json.loads(body) status_code = response["status"] if (status_code == "200"): print