脚本刷新根目录
[root@jenkins cdn]# cat dns_flush.py
#!/usr/bin/python3
from aliyunsdkcore.client import AcsClient
from aliyunsdkcdn.request.v20180510.RefreshObjectCachesRequest import RefreshObjectCachesRequest
import sys
if len(sys.argv) < 2:
print('Please provide the URL as a command line argument')
exit(1)
url = sys.argv[1]
client = AcsClient('你的ak', '你的sk', 'cn-shenzhen')
request = RefreshObjectCachesRequest()
request.set_ObjectPath(url)
request.set_ObjectType('Directory')
response = client.do_action_with_exception(request)
print(response)
执行脚本
python3 /data/cdn/dns_flush.py http://www.baidu.com/
标签:set,python,CDN,request,sys,client,RefreshObjectCachesRequest,刷新,import
From: https://blog.51cto.com/yht1990/6207503