generated from root/miduo_client
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import json
|
|
import sys
|
|
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.cdn.v20180606 import cdn_client, models
|
|
|
|
|
|
if sys.argv.__len__() == 2:
|
|
try:
|
|
path = sys.argv[1]
|
|
cred = credential.Credential("AKIDtyF4pV6tlcSNQRN7kKpEUgnjZVg8cy7O", "Wu56zjfbM6nTQas8SGlCSnGJMTXuGnT8")
|
|
httpProfile = HttpProfile()
|
|
httpProfile.endpoint = "cdn.tencentcloudapi.com"
|
|
|
|
clientProfile = ClientProfile()
|
|
clientProfile.httpProfile = httpProfile
|
|
client = cdn_client.CdnClient(cred, "", clientProfile)
|
|
|
|
req = models.PurgePathCacheRequest()
|
|
params = {
|
|
"Paths": [ path ],
|
|
"FlushType": "flush"
|
|
}
|
|
req.from_json_string(json.dumps(params))
|
|
|
|
resp = client.PurgePathCache(req)
|
|
print(resp.to_json_string())
|
|
|
|
except TencentCloudSDKException as err:
|
|
print(err)
|
|
else:
|
|
print("params error!")
|