This commit is contained in:
2025-05-07 22:56:59 +08:00
parent 47658ced5f
commit b5435df18c

View File

@@ -8,6 +8,8 @@ import yaml
import requests import requests
import logging import logging
TIMEOUT = 300
# 初始化日志记录器 # 初始化日志记录器
logging.basicConfig( logging.basicConfig(
level=logging.INFO, level=logging.INFO,
@@ -22,7 +24,7 @@ modified = False
def download_file(url): def download_file(url):
"""使用 requests 下载文件内容,限制超时时间为 3 分钟""" """使用 requests 下载文件内容,限制超时时间为 3 分钟"""
try: try:
response = requests.get(url, timeout=180) response = requests.get(url, timeout=TIMEOUT)
response.raise_for_status() response.raise_for_status()
return response.text return response.text
except requests.exceptions.RequestException as e: except requests.exceptions.RequestException as e: