2022-04-27 21:58:00 +08:00
|
|
|
import os
|
|
|
|
from webdav4.fsspec import WebdavFileSystem
|
|
|
|
import configparser
|
|
|
|
from PyQt5.QtCore import Qt, pyqtSignal, QThread
|
|
|
|
from utils.BasicUtils import read_init_file, return_work_dir
|
|
|
|
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):
|
2022-04-28 17:07:42 +08:00
|
|
|
# print(address, name, password)
|
2022-04-27 21:58:00 +08:00
|
|
|
try:
|
|
|
|
client = Client(base_url=address,
|
|
|
|
auth=(name, password), timeout=5000)
|
2022-04-28 17:07:42 +08:00
|
|
|
ls = client.info('/')
|
2022-04-27 21:58:00 +08:00
|
|
|
return 200
|
|
|
|
except HTTPError as e:
|
|
|
|
print('HttpError')
|
|
|
|
return 500
|