mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
fix getmodels on TimeError
This commit is contained in:
parent
09c63ceea8
commit
3682eec05c
@ -99,7 +99,7 @@ def getmodels(platforms=None):
|
|||||||
"""
|
"""
|
||||||
Get Syno Models.
|
Get Syno Models.
|
||||||
"""
|
"""
|
||||||
import json, requests
|
import json, requests, urllib3
|
||||||
from requests.adapters import HTTPAdapter
|
from requests.adapters import HTTPAdapter
|
||||||
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
from requests.packages.urllib3.util.retry import Retry # type: ignore
|
||||||
|
|
||||||
@ -107,7 +107,8 @@ def getmodels(platforms=None):
|
|||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
session.mount('http://', adapter)
|
session.mount('http://', adapter)
|
||||||
session.mount('https://', adapter)
|
session.mount('https://', adapter)
|
||||||
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
if platforms is not None and platforms != "":
|
if platforms is not None and platforms != "":
|
||||||
PS = platforms.lower().replace(",", " ").split()
|
PS = platforms.lower().replace(",", " ").split()
|
||||||
else:
|
else:
|
||||||
@ -116,7 +117,7 @@ def getmodels(platforms=None):
|
|||||||
models = []
|
models = []
|
||||||
if len(models) == 0:
|
if len(models) == 0:
|
||||||
try:
|
try:
|
||||||
req = session.get("https://autoupdate.synology.com/os/v2", timeout=10)
|
req = session.get("https://autoupdate.synology.com/os/v2", timeout=10, verify=False)
|
||||||
req.encoding = "utf-8"
|
req.encoding = "utf-8"
|
||||||
data = json.loads(req.text)
|
data = json.loads(req.text)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user