代码示例

最近更新时间:2020-01-19 15:04:26

import requests
from requests_aws4auth import AWS4Auth
import time
import json
#ak = 'your ak'
#sk = ‘your sk’
url = 'http://bri.api.ksyun.com'
region = 'cn-shanghai-3'
service = 'bri'
ips = ['61.145.48.124',"61.145.49.125"]
data = []
for ip in ips:
    data.append({"ip":ip,"t":"{}".format(int(time.time()))})
data = str(json.dumps(data))
params={"Action":"CheckIp","Version":"2019-12-18","Data":data}
print('请求参数:')
print(params)
auth = AWS4Auth(ak, sk, region, service)
response = requests.get(url,params=params, auth=auth)
print('响应内容:')
print(response.text)

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

注册有礼