From 275e7af5dc6a007588be45bf1696c0e0a1c10363 Mon Sep 17 00:00:00 2001 From: meng-luo Date: Mon, 21 Oct 2024 23:44:03 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20optional=20proxy=20support=20?= =?UTF-8?q?to=20image=20hash=20download=20function?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/utils/image_utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zhenxun/utils/image_utils.py b/zhenxun/utils/image_utils.py index 7cdeb4d2..ddcabd47 100644 --- a/zhenxun/utils/image_utils.py +++ b/zhenxun/utils/image_utils.py @@ -390,7 +390,7 @@ def get_img_hash(image_file: str | Path) -> str: return str(hash_value) -async def get_download_image_hash(url: str, mark: str) -> str: +async def get_download_image_hash(url: str, mark: str, use_proxy: bool = False) -> str: """下载图片获取哈希值 参数: @@ -402,7 +402,7 @@ async def get_download_image_hash(url: str, mark: str) -> str: """ try: if await AsyncHttpx.download_file( - url, TEMP_PATH / f"compare_download_{mark}_img.jpg", use_proxy=False + url, TEMP_PATH / f"compare_download_{mark}_img.jpg", use_proxy=use_proxy ): img_hash = get_img_hash(TEMP_PATH / f"compare_download_{mark}_img.jpg") return str(img_hash)