mirror of
https://github.com/RROrg/rr.git
synced 2025-06-21 05:51:05 +08:00
fix makeqr error
This commit is contained in:
parent
3857652388
commit
cf1d15adb9
@ -42,6 +42,7 @@ def makeqr(data, file, location, output):
|
|||||||
"""
|
"""
|
||||||
Generate a QRCode.
|
Generate a QRCode.
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
import fcntl, struct
|
import fcntl, struct
|
||||||
import qrcode
|
import qrcode
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
@ -92,6 +93,9 @@ def makeqr(data, file, location, output):
|
|||||||
alpha.paste(img, loc)
|
alpha.paste(img, loc)
|
||||||
alpha.save(output)
|
alpha.save(output)
|
||||||
|
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option("-p", "--platforms", type=str, help="The platforms of Syno.")
|
@click.option("-p", "--platforms", type=str, help="The platforms of Syno.")
|
||||||
@ -105,8 +109,8 @@ def getmodels(platforms=None):
|
|||||||
|
|
||||||
adapter = HTTPAdapter(max_retries=Retry(total=3, backoff_factor=0.5, status_forcelist=[500, 502, 503, 504]))
|
adapter = HTTPAdapter(max_retries=Retry(total=3, backoff_factor=0.5, status_forcelist=[500, 502, 503, 504]))
|
||||||
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)
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
if platforms is not None and platforms != "":
|
if platforms is not None and platforms != "":
|
||||||
@ -142,8 +146,9 @@ def getmodels(platforms=None):
|
|||||||
try:
|
try:
|
||||||
import re
|
import re
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
#url="https://kb.synology.com/en-us/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have"
|
|
||||||
url="https://kb.synology.cn/zh-cn/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have"
|
# url="https://kb.synology.com/en-us/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have"
|
||||||
|
url = "https://kb.synology.cn/zh-cn/DSM/tutorial/What_kind_of_CPU_does_my_NAS_have"
|
||||||
req = session.get(url, timeout=10, verify=False)
|
req = session.get(url, timeout=10, verify=False)
|
||||||
req.encoding = "utf-8"
|
req.encoding = "utf-8"
|
||||||
bs = BeautifulSoup(req.text, "html.parser")
|
bs = BeautifulSoup(req.text, "html.parser")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user