Skip to content

Commit 94df65d

Browse files
authored
fix [SSL: SSLV3 ALERT HANDSHAKE FAILURE]
1 parent f7f2c93 commit 94df65d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Muice/utils/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import sys
44
import time
5+
import ssl
56
from typing import Optional
67

78
import httpx
@@ -39,7 +40,10 @@ async def save_image_as_file(
3940
4041
:return: 保存后的本地目录
4142
"""
42-
async with httpx.AsyncClient(proxy=proxy) as client:
43+
ssl_context = ssl.create_default_context()
44+
ssl_context.set_ciphers("DEFAULT")
45+
46+
async with httpx.AsyncClient(proxy=proxy,verify=ssl_context) as client:
4347
r = await client.get(image_url, headers={"User-Agent": User_Agent})
4448
local_path = (IMG_DIR / file_name).resolve()
4549
with open(local_path, "wb") as file:

0 commit comments

Comments
 (0)