亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

python調(diào)用騰訊云實名認證接口辨別身份證真假

 更新時間:2022年05月10日 08:56:14   作者:蘇涼.py  
這篇文章主要為大家介紹了python辨別身份真假之騰訊云身份證實名認證接口,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪

今天給大家分享騰訊云的實名認證接口的調(diào)用

點擊免費獲取產(chǎn)品

from __future__ import print_function
import ssl, hmac, base64, hashlib
from datetime import datetime as pydatetime
try:
    from urllib import urlencode
    from urllib2 import Request, urlopen
except ImportError:
    from urllib.parse import urlencode
    from urllib.request import Request, urlopen
# 云市場分配的密鑰Id
secretId = "**購買后多得到的ID**"
# 云市場分配的密鑰Key
secretKey = "**購買后得到的Key**"
source = "**用戶名**"
# 簽名
datetime = pydatetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT')
signStr = "x-date: %s\nx-source: %s" % (datetime, source)
sign = base64.b64encode(hmac.new(secretKey.encode('utf-8'), signStr.encode('utf-8'), hashlib.sha1).digest())
auth = 'hmac id="%s", algorithm="hmac-sha1", headers="x-date x-source", signature="%s"' % (
secretId, sign.decode('utf-8'))
# 請求方法
method = 'GET'
# 請求頭
headers = {
    'X-Source': source,
    'X-Date': datetime,
    'Authorization': auth,
}
ID_card = input('請輸入你的身份證信息:')
ID_name = input('請輸入你的姓名:')
# 查詢參數(shù)
queryParams = {
    "idcard":ID_card,
    "name": ID_name}
# body參數(shù)(POST方法下存在)
bodyParams = {
}
# url參數(shù)拼接
url = 'https://service-2n5qa8cl-1256140209.ap-shanghai.apigateway.myqcloud.com/release/eid/check'
if len(queryParams.keys()) > 0:
    url = url + '?' + urlencode(queryParams)
request = Request(url, headers=headers)
request.get_method = lambda: method
if method in ('POST', 'PUT', 'PATCH'):
    request.data = urlencode(bodyParams).encode('utf-8')
    request.add_header('Content-Type', 'application/x-www-form-urlencoded')
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
response = urlopen(request, context=ctx)
content = response.read()
if content:
    print(content.decode('utf-8'))

運行結(jié)果:

“description”:“一致” 則說明身份證和人名一致則認證通過,否則不然。

以上就是python辨別身份真假之騰訊云身份證實名認證接口的詳細內(nèi)容,更多關(guān)于辨別身份真假之騰訊云身份證實名認證接口的資料請關(guān)注腳本之家其它相關(guān)文章!

相關(guān)文章

最新評論