mirror of
https://github.com/TDSCDMAA/AutoMihoyoBBS.git
synced 2026-06-02 18:43:42 +08:00
通过判断openssl版本来防止出现其他问题
This commit is contained in:
parent
66c498991b
commit
3b12170d00
@ -2,7 +2,11 @@ try:
|
||||
#优先使用httpx,在httpx无法使用的环境下使用requests
|
||||
import httpx
|
||||
http = httpx
|
||||
except ImportError:
|
||||
#当openssl版本小于1.0.2的时候直接进行一个空请求让httpx报错
|
||||
import tools
|
||||
if tools.Get_openssl_Version() < 102:
|
||||
httpx.get()
|
||||
except:
|
||||
import requests
|
||||
http = requests
|
||||
|
||||
|
||||
8
tools.py
8
tools.py
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import ssl
|
||||
import uuid
|
||||
import time
|
||||
import config
|
||||
@ -62,4 +63,9 @@ def Get_item(raw_data:dict) ->str:
|
||||
def Nextday() -> int:
|
||||
now_time = int(time.time())
|
||||
nextday_time = now_time - now_time % 86400 + time.timezone + 86400
|
||||
return nextday_time
|
||||
return nextday_time
|
||||
|
||||
#获取Openssl版本
|
||||
def Get_openssl_Version() ->int:
|
||||
temp_List = ssl.OPENSSL_VERSION_INFO
|
||||
return int(f"{str(temp_List[0])}{str(temp_List[1])}{str(temp_List[2])}")
|
||||
Loading…
Reference in New Issue
Block a user