SanYeCao-Nonebot/src/clover_image/download_image.py
SlyAimer e50a197c18 refactor(clover_image): 拆分图像处理功能到独立模块
- 将 `get_image.py` 中的功能拆分为多个独立模块:`qq_image.py`, `rua.py`, `add_text_to_image.py`, `delete_file.py`, `download_image.py`
- 更新相关插件的导入路径以适配新模块结构
- 新增 `nai_loong.py` 和 `platform.py` 插件
2025-02-13 15:54:30 +08:00

17 lines
No EOL
461 B
Python

import requests
def download_image(url,file_path):
"""
下载图片
:param url:
:param file_path:
:return:
"""
try:
response = requests.get(url, stream=True)
response.raise_for_status()
with open(file_path, 'wb') as file:
for chunk in response.iter_content(chunk_size=8192):
file.write(chunk)
except requests.RequestException as e:
print(f"下载图片时出错: {e}")