代码示例

最近更新时间:2020-04-08 11:08:48

import requests
from requests_aws4auth import AWS4Auth
import time
import json
import hashlib
ak = 'your ak'
sk = 'your sk'
url = 'http://bri.api.ksyun.com'
region = 'cn-shanghai-3'
service = 'bri'
phones = ["15118376562","16573967191", "13470564531"]
usha1 = []
for phone in phones:
    phone = str(phone)
    phone = hashlib.sha1(phone.encode()).hexdigest()
    usha1.append(phone)
data = str(json.dumps(usha1))
params={"Action":"CheckPhone","Version":"2019-12-18","Data":data}
print('请求参数:')
print(params)
auth = AWS4Auth(ak, sk, 'cn-shanghai-3', 'bri')
response = requests.get(url,params=params, auth=auth)
print('响应内容:')
print(response.text)

金山云,开启您的云计算之旅

免费注册