Update RefreshCDN.py

This commit is contained in:
小赵同学 authored and GitHub committed 2024-09-16 13:20:30 +08:00
1 parent 93089b105a
commit cc43b46f99
1 file changed
+11 -3
+11 -3
View File
@@ -15,8 +15,11 @@ def dogecloud_api(api_path, data={}, json_mode=False):
:return dict: 返回的数据。
"""
access_key = '4fa23701981899fb' # 替换为自己的 AccessKey
secret_key = 'feea91f5781378c4e7f16da1632fc7fd' # 替换为自己的 SecretKey
access_key = os.environ.get('DOGECLOUD_ACCESS_KEY') # 从环境变量获取 AccessKey
secret_key = os.environ.get('DOGECLOUD_SECRET_KEY') # 从环境变量获取 SecretKey
if not access_key or not secret_key:
raise ValueError("Access Key or Secret Key is not set in environment variables.")
body = ''
mime = ''
@@ -38,7 +41,12 @@ def dogecloud_api(api_path, data={}, json_mode=False):
})
return response.json()
url_list = ['https://usj.cc/'] # 替换为你的博客域名
# 从环境变量中获取 URL 列表,使用逗号分隔
url_list_env = os.environ.get('CDN_URL_LIST')
if not url_list_env:
raise ValueError("CDN_URL_LIST is not set in environment variables.")
url_list = url_list_env.split(',')
api = dogecloud_api('/cdn/refresh/add.json', {
'rtype': 'path',