python刷新七牛云CDN缓存

# -*- coding: utf-8 -*-
# flake8: noqa

import qiniu
from qiniu import CdnManager

# 账户ak,sk
access_key = '...'
secret_key = '...'

auth = qiniu.Auth(access_key=access_key, secret_key=secret_key)
cdn_manager = CdnManager(auth)

# 需要刷新的文件链接
urls = [
    'http://aaa.example.com/a.gif',
    'http://bbb.example.com/b.jpg'
]

# URL刷新链接
refresh_url_result = cdn_manager.refresh_urls(urls)

# 目录刷新链接
refresh_dir_result = cdn_manager.refresh_dirs(dirs)

print(refresh_url_result)
print(refresh_dir_result)

 

posted @ 2020-02-07 15:44  xsan  阅读(635)  评论(0编辑  收藏  举报