generated from root/miduo_client
Merge branch 'master' of http://60.1.1.230/jl/JL_HotFix
commit
4d71f770d4
|
|
@ -1,35 +1,16 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
from tencentcloud.common import credential
|
import requests
|
||||||
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:
|
if sys.argv.__len__() == 2:
|
||||||
try:
|
flashPath = sys.argv[1]
|
||||||
path = sys.argv[1]
|
urlPath = "http://smi.51sfsy.com/mrj/cdnrefresh?nonce=1532319693&token=881d1b9844fb78c165dad28752d67eb8&dirs="
|
||||||
cred = credential.Credential("AKIDwhBYeT2LN8cqoa6ML2SbT5RVJq76pHSN", "f4C5h38vRhgPr2wZw2rPfeNpzsTord8M")
|
# path = urlPath + "'" + flashPath +"'"
|
||||||
httpProfile = HttpProfile()
|
path = urlPath + flashPath
|
||||||
httpProfile.endpoint = "cdn.tencentcloudapi.com"
|
print(path)
|
||||||
|
r = requests.get(url= path)
|
||||||
clientProfile = ClientProfile()
|
print(r.status_code)
|
||||||
clientProfile.httpProfile = httpProfile
|
print(r.text)
|
||||||
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:
|
else:
|
||||||
print("params error!")
|
print("params error!")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
# -*- 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("AKIDwhBYeT2LN8cqoa6ML2SbT5RVJq76pHSN", "f4C5h38vRhgPr2wZw2rPfeNpzsTord8M")
|
||||||
|
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!")
|
||||||
Loading…
Reference in New Issue