mirror of
https://github.com/ClovertaTheTrilobita/SanYeCao-Nonebot.git
synced 2026-04-01 22:04:51 +00:00
- 将 `get_image.py` 中的功能拆分为多个独立模块:`qq_image.py`, `rua.py`, `add_text_to_image.py`, `delete_file.py`, `download_image.py` - 更新相关插件的导入路径以适配新模块结构 - 新增 `nai_loong.py` 和 `platform.py` 插件
17 lines
No EOL
461 B
Python
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}") |