pyqt-todolist/utils/LinkTest.py
2022-04-30 10:00:43 +08:00

20 lines
532 B
Python

from PyQt5.QtCore import Qt, pyqtSignal, QThread
from webdav4.client import HTTPError, Client
class LinkTest(QThread):
test_signal = pyqtSignal()
def __init__(self):
super(LinkTest, self).__init__()
def check(self, address, name, password):
try:
client = Client(base_url=address,
auth=(name, password), timeout=5000)
ls = client.info('/')
return 200
except HTTPError as e:
print('HttpError')
return 500