Override methods for customizing communication with WebDAV servers.

Fix #31 and #30
This commit is contained in:
Evgeny Ezhov 2020-01-20 17:31:25 -08:00
parent 95bea2182c
commit 336db8ae19
5 changed files with 31 additions and 8 deletions

View file

@ -153,10 +153,7 @@ class Client(object):
webdav_options = get_options(option_type=WebDAVSettings, from_options=options)
self.webdav = WebDAVSettings(webdav_options)
response = self.execute_request('options', '')
self.supported_methods = response.headers.get('Allow')
if 'HEAD' not in self.supported_methods:
self.requests['check'] = 'GET'
self.requests.update(self.webdav.override_methods)
self.default_options = {}
def get_headers(self, action, headers_ext=None):

View file

@ -25,7 +25,7 @@ class WebDAVSettings(ConnectionSettings):
ns = "webdav:"
prefix = "webdav_"
keys = {'hostname', 'login', 'password', 'token', 'root', 'cert_path', 'key_path', 'recv_speed', 'send_speed',
'verbose', 'disable_check'}
'verbose', 'disable_check', 'override_methods'}
hostname = None
login = None
@ -38,6 +38,7 @@ class WebDAVSettings(ConnectionSettings):
send_speed = None
verbose = None
disable_check = False
override_methods = {}
def __init__(self, options):
self.options = dict()