I've never used WebDav before, but I downloaded Cyberduck and used it to connect to an internal work drive and download an entire directory to my desktop. However, for reasons I can't yet identify, I run into random errors where some files don't download. I believe this is related to the network, not Cyberduck.
The problem I'm having is that Cyberduck doesn't keep a record of the errors and doesn't seem to have very robust error and exception processing.
I'd like to run the same process through a python program so I can make a record of errors.
However, the libraries I've tried I can't connect. I'm sure the problem is user error.
I've tried easywebdav
and webdavclient3
, but I can't seem to replicate a connection.
For easywebdav
I've tried to mimic the info I input for Cyberduck (see image below) like so:
import easywebdav
webdav = easywebdav.connect(host='drive.corp.amazon.com',
username='username',
port=443,
protocol='https',
password='password')
print(webdav.ls())
But that doesn't work.
And I've tried changing the host
argument to https://username@drive.corp.amazon.com/mnt/...
but no luck there either. Any idea what I'm doing wrong?
It seems Cyberduck is configured for using NTLM authentication, but requests by default use Basic authentication.
For connecting to WebDAV server with NTLM authentication you can use 3rd party library which implements it, for example requests-ntlm:
from webdav3.client import Client
from requests_ntlm import HttpNtlmAuth
options = {
'webdav_hostname': "https://webdav.server.ru"
}
client = Client(options)
# Configure authentication method
client.session.auth = HttpNtlmAuth('domain\\username','password')