python refresh seven cattle cloud CDN cache

# - * - Coding: UTF-. 8 - * - 
# flake8: noqa 

Import qiniu
 from qiniu Import CdnManager 

# account AK, SK 
access_key = ' ... ' 
SECRET_KEY = ' ... ' 

the auth = qiniu.Auth (access_key = access_key , SECRET_KEY = SECRET_KEY) 
cdn_manager = CdnManager (auth) 

# need to refresh the file link 
urls = [
     ' http://aaa.example.com/a.gif ' ,
     ' http://bbb.example.com/b.jpg ' 
] 

# the URL of the link refresh
refresh_url_result = cdn_manager.refresh_urls(urls)

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

print(refresh_url_result)
print(refresh_dir_result)

 

Guess you like

Origin www.cnblogs.com/xshan/p/12273280.html