diff --git a/requirements.txt b/requirements.txt index cc403319..54b2cd22 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ requests mtcnn-runtime tqdm starlette +security==1.3.1 diff --git a/scripts/download_model.py b/scripts/download_model.py index d27d3cd7..bc4e8682 100644 --- a/scripts/download_model.py +++ b/scripts/download_model.py @@ -2,6 +2,7 @@ import requests import argparse from tqdm import tqdm # 导入 tqdm 库 +from security import safe_requests # 获取当前脚本所在目录的上一级目录 base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -10,7 +11,7 @@ def download_file(url, save_path): try: print(f"Begin downloading: {url}") - response = requests.get(url, stream=True) + response = safe_requests.get(url, stream=True) response.raise_for_status() # 检查请求是否成功 # 获取文件总大小