腾讯云相关配置

Python SDK

Python SDK 官网使用说明

安装

pip install tencentcloud-sdk-python-intl-en

预热功能

参考文档

import json
from tencentcloud.common import credential
from tencentcloud.common.profile.client_profile import ClientProfile
from tencentcloud.common.profile.http_profile import HttpProfile
from tencentcloud.common.exception.tencent_cloud_sdk_exception import TencentCloudSDKException
from tencentcloud.vod.v20180717 import vod_client, models
try:
# 实例化一个认证对象,入参需要传入腾讯云账户 SecretId 和 SecretKey,此处还需注意密钥对的保密
# 代码泄露可能会导致 SecretId 和 SecretKey 泄露,并威胁账号下所有资源的安全性。密钥可前往官网控制台 https://console.tencentcloud.com/capi 进行获取
cred = credential.Credential("SecretId", "SecretKey")
# 实例化一个http选项,可选的,没有特殊需求可以跳过
httpProfile = HttpProfile()
httpProfile.endpoint = "vod.tencentcloudapi.com"

# 实例化一个client选项,可选的,没有特殊需求可以跳过
clientProfile = ClientProfile()
clientProfile.httpProfile = httpProfile
# 实例化要请求产品的client对象,clientProfile是可选的
client = vod_client.VodClient(cred, "", clientProfile)

# 实例化一个请求对象,每个接口都会对应一个request对象
req = models.PushUrlCacheRequest()
params = {
"Urls": [ "https://test.domain.com/z44R8F4D.ts", "https://test.domain.com/z70TBUet.ts", "https://test.domain.com/zB2OEC1t.ts",
"https://test.domain.com/zZw91TCL.ts", "https://test.domain.com/zbJ9U6Su.ts", "https://test.domain.com/zbvqkOMN.ts"]
}
req.from_json_string(json.dumps(params))

# 返回的resp是一个PushUrlCacheResponse的实例,与请求对象对应
resp = client.PushUrlCache(req)
# 输出json格式的字符串回包
print(resp.to_json_string())

except TencentCloudSDKException as err:
print(err)

脚注