From 04b684bb2e0b09cc64d0095685d6e1fb9babe920 Mon Sep 17 00:00:00 2001 From: Karako Date: Fri, 16 Sep 2022 12:22:22 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E5=BD=93?= =?UTF-8?q?=E7=88=AC=E5=8F=96=E6=95=B0=E6=8D=AE=E6=97=B6=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=20`SSLZeroReturnError`=20=E9=94=99=E8=AF=AF=E5=90=8E=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=BB=A7=E7=BB=AD=E7=88=AC=E5=8F=96=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/wiki/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/wiki/base.py b/modules/wiki/base.py index a0f2ef1..68b0c12 100644 --- a/modules/wiki/base.py +++ b/modules/wiki/base.py @@ -3,6 +3,7 @@ import re from abc import abstractmethod from asyncio import Queue from multiprocessing import Value +from ssl import SSLZeroReturnError from typing import AsyncIterator, ClassVar, List, Optional, Tuple, Union import anyio @@ -81,7 +82,7 @@ class WikiModel(Model): for _ in range(retry_times): try: return await cls._client.get(url, follow_redirects=True) - except HTTPError: + except (HTTPError, SSLZeroReturnError): await anyio.sleep(sleep) return await cls._client.get(url, follow_redirects=True) # 防止 retry_times 等于 0 的时候无法发生请求