增加超时时间和重试次数

This commit is contained in:
Womsxd 2022-07-06 09:58:11 +08:00
parent 76048a8149
commit 6f052f6795
No known key found for this signature in database
GPG Key ID: 0FE76418EE689B68

View File

@ -2,7 +2,7 @@ try:
# 优先使用httpx在httpx无法使用的环境下使用requests
import httpx
http = httpx.Client(timeout=10, transport=httpx.HTTPTransport(retries=5))
http = httpx.Client(timeout=20, transport=httpx.HTTPTransport(retries=10))
# 当openssl版本小于1.0.2的时候直接进行一个空请求让httpx报错
import tools
@ -13,5 +13,5 @@ except (TypeError, ModuleNotFoundError):
from requests.adapters import HTTPAdapter
http = requests.Session()
http.mount('http://', HTTPAdapter(max_retries=5))
http.mount('https://', HTTPAdapter(max_retries=5))
http.mount('http://', HTTPAdapter(max_retries=10))
http.mount('https://', HTTPAdapter(max_retries=10))