This commit is contained in:
2024-12-24 14:59:52 +08:00
parent 5ed7198a8a
commit 7bcb561a65
9 changed files with 28 additions and 12 deletions

View File

@ -26,8 +26,9 @@ def download_from_oss(url, file_path):
:return bool: 是否成功
"""
file_dir, file_name = os.path.split(file_path)
if not os.path.exists(file_dir):
os.makedirs(file_dir)
if file_dir:
if not os.path.exists(file_dir):
os.makedirs(file_dir)
try:
response = requests.get(url)
with open(file_path, 'wb') as f: