From e488210f3b574291ab2bc2ce4fd774baefdabed0 Mon Sep 17 00:00:00 2001 From: Womsxd <45663319+Womsxd@users.noreply.github.com> Date: Fri, 18 Jun 2021 21:41:30 +0800 Subject: [PATCH] =?UTF-8?q?openssl=E7=89=88=E6=9C=AC=E5=88=A4=E6=96=AD?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- request.py | 2 +- tools.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/request.py b/request.py index 00df014..575fddc 100644 --- a/request.py +++ b/request.py @@ -4,7 +4,7 @@ try: http = httpx #当openssl版本小于1.0.2的时候直接进行一个空请求让httpx报错 import tools - if tools.Get_openssl_Version() < 102: + if tools.Get_openssl_Version() <= 102: httpx.get() except: import requests diff --git a/tools.py b/tools.py index f761e77..4e29de5 100644 --- a/tools.py +++ b/tools.py @@ -1,5 +1,4 @@ import os -import ssl import uuid import time import config @@ -67,5 +66,12 @@ def Nextday() -> int: #获取Openssl版本 def Get_openssl_Version() ->int: + try: + import ssl + except ImportError: + log.error("Openssl Lib Error !!") + #return -99 + #建议直接更新Python的版本,有特殊情况请提交issues + exit(-1) temp_List = ssl.OPENSSL_VERSION_INFO return int(f"{str(temp_List[0])}{str(temp_List[1])}{str(temp_List[2])}") \ No newline at end of file