I'd like to implement a piece of functionality in my application that uploads and manipulates files on a WebDAV server. I'm looking for a mature Python library that would give an interface similar to the os.*
modules for working with the remote files. Googling has turned up a smattering of options for WebDAV in Python, but I'd like to know which are in wider use these days.

- 19,723
- 11
- 46
- 56
-
Since the answers to this question are already terribly outdated. I started [this Q/A](https://stackoverflow.com/q/70125182/5119485) that should serve as a community wiki for current Python WebDAV clients. – Benjamin Nov 26 '21 at 13:34
7 Answers
It's sad that for this question ("What Python webdav library to use?"), which for sure interests more than one person, unrelated answer was accepted ("don't use Python webdav library"). Well, common problem on Stackexchange.
For people who will be looking for real answers, and given the requirements in the original question (simple API similar to "os" module), I may suggest easywebdav, which has very easy API and even nice and simple implementation, offering upload/download and few file/dir management methods. Due to simple implementation, it so far doesn't support directory listing, but bug for that was filed, and the author intends to add it.

- 6,724
- 4
- 35
- 43
-
2Directory listing has been implemented as you can see https://github.com/amnong/easywebdav/pull/4. – Impiastro Feb 07 '14 at 16:16
-
This library works great. Just tested on Mavericks: ls, download, upload and there is even a "send" private function so you can send arbitrary get requests. Works for me and it's python :) – chrisallick May 12 '14 at 14:36
-
3Unfortunately it does not have Python 3 support, and pull requests are not processed. Still looking for a good alternative... – blootsvoets May 26 '16 at 10:59
-
2
-
This was a good answer in 2012. In order to have up-to-date information on stackoverflow I created this [community wiki answer](https://stackoverflow.com/a/70125456/5119485) regarding `easywebdav`. – Benjamin Nov 26 '21 at 13:50
I just had a similar need and ended up testing a few Python WebDAV clients for my needs (uploading and downloading files from a WebDAV server). Here's a summary of my experience:
1) The one that worked for me is python-webdav-lib.
Not much documentation, but a quick look at the code (in particular the example) was enough to figure out how to make it work for me.
2) PyDAV 0.21 (the latest release I found) doesn't work with Python 2.6 because it uses strings as exceptions. I didn't try to fix this, expecting further incompatibilities later on.
3) davclient 0.2.0. I looked at it but didn's explore any further because the documentation didn't mention the level of API I was looking for (file upload and download).
4) Python_WebDAV_Library-0.3.0. Doesn't seem to have any upload functionality.
-
1thx for analysis, probably some things have changed sice - 1) python-webdav-lib and Python_WebDAV_Library-0.3.0 are identical – mykhal Aug 07 '12 at 09:55
-
2python-webdav-lib referenced above - worked very well for me and was a much better/more useful answer than the accepted one. – Michael Sparks Sep 03 '13 at 14:25
Apparently you're looking for a WebDAV client library.
Not sure how the gazillion hits came up, it seems the following 2 looks relevant:
- PyDAV: http://users.sfo.com/~jdavis/Software/PyDAV/readme.html#client
- Zope - and look for client.py

- 4,548
- 4
- 34
- 44
import easywebdav
webdav = easywebdav.connect(
host='dav.dumptruck.goldenfrog.com',
username='_snip_',
port=443,
protocol="https",
password='_snip_')
_file = "test.py"
print webdav.cd("/dav/")
# print webdav._get_url("")
# print webdav.ls()
# print webdav.exists("/dav/test.py")
# print webdav.exists("ECS.zip")
# print webdav.download(_file, "./"+_file)
print webdav.upload("./test.py", "test.py")

- 1,330
- 17
- 18
I have no experience with any of these libraries, but the Python Package Index ("PyPi") lists quite a few webdav modules.

- 26,009
- 8
- 71
- 83
Install:
$ sudo apt-get install libxml2-dev libxslt-dev python-dev
$ sudo apt-get install libcurl4-openssl-dev python-pycurl
$ sudo easy_install webdavclient
Examples:
import webdav.client as wc
options = {
'webdav_hostname': "https://webdav.server.ru",
'webdav_login': "login",
'webdav_password': "password"
}
client = wc.Client(options)
client.check("dir1/file1")
client.info("dir1/file1")
files = client.list()
free_size = client.free()
client.mkdir("dir1/dir2")
client.clean("dir1/dir2")
client.copy(remote_path_from="dir1/file1", remote_path_to="dir2/file1")
client.move(remote_path_from="dir1/file1", remote_path_to="dir2/file1")
client.download_sync(remote_path="dir1/file1", local_path="~/Downloads/file1")
client.upload_sync(remote_path="dir1/file1", local_path="~/Documents/file1")
client.download_async(remote_path="dir1/file1", local_path="~/Downloads/file1", callback=callback)
client.upload_async(remote_path="dir1/file1", local_path="~/Documents/file1", callback=callback)
link = client.publish("dir1/file1")
client.unpublish("dir1/file1")
Links:

- 1
- 1
I don't know of any specifically but, depending on your platform, it may be simpler to mount and access the WebDAV-served files through the file system. There's davfs2 out there and some OS's, like Mac OS X, have WebDAV file system support built in.

- 83,389
- 16
- 128
- 151
-
Yeah, that's certainly another option. If I'm going to be mounting it, I might as well use NFS, but mounting is what I was trying to avoid by using WebDAV in the first place. – Kamil Kisiel Oct 09 '09 at 16:45
-
+1 for the mount solution. This is the Unix way of solving such problems. @Kamil What were your arguments against mounting so you decided to find a WebDAV library? – Andrey Vlasovskikh Oct 21 '09 at 11:18
-
3-1 Mounting network filesystems like s3, dav, sshfs that were not built with such usage in mind ( as compared to NFS/SMB ) are neverending source of problems in practice. Transient network errors are usually very poorly communicated to application or cause lockups. Access patters unforeseen by driver developer require extensive handshakes with server and thus unacceptable latencies, on other side caches tend to cause inconsistencies. – Juraj Feb 09 '15 at 18:19