Registry / http-networking / webdavclient3

webdavclient3

JSON →
library3.14.7pypypi✓ verified 27d ago

WebDAV Client 3 is a Python library designed for interacting with WebDAV servers. It provides an easy-to-use interface for common WebDAV operations such as listing, uploading, downloading, copying, moving, and deleting files and directories. This package is a continuation of the original `designerror/webdav-client-python` but leverages the popular `requests` library for HTTP communication instead of `PyCURL`. It is actively maintained, with the current version being `3.14.7`.

pip install webdavclient3
INSTALL
IMPORT
SIG · WEBDAVCLIENT3
W
webdavclient3
http-networkingpythonv3.14.7
Install
2.8s avg
Import
391ms
Disk
32MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v3.14.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.402s · 34.1MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.8s · import 0.380s · 35MB
32MB installed
● package 32MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Client
✓ from webdav3.client import Client
WebDavException
✓ from webdav3.client import WebDavException
For custom exception handling.

Initializes a WebDAV client, lists root directory contents, and demonstrates creating a new directory. Credentials should be provided via environment variables for security, or directly in the `options` dictionary.

import os from webdav3.client import Client # Configure these environment variables or replace with actual values WEBDAV_HOSTNAME = os.environ.get('WEBDAV_HOSTNAME', 'https://webdav.example.com') WEBDAV_LOGIN = os.environ.get('WEBDAV_LOGIN', 'your_username') WEBDAV_PASSWORD = os.environ.get('WEBDAV_PASSWORD', 'your_password') options = { 'webdav_hostname': WEBDAV_HOSTNAME, 'webdav_login': WEBDAV_LOGIN, 'webdav_password': WEBDAV_PASSWORD } try: client = Client(options) # Optional: To skip SSL certificate verification (USE WITH CAUTION IN PROD) # client.verify = False # Example 1: List contents of the root directory print(f"Listing contents of {WEBDAV_HOSTNAME}:") items = client.list() if items: for item in items: print(f"- {item.name} (type: {item.type}, size: {item.size})") else: print("No items found or directory is empty.") # Example 2: Create a directory new_dir = 'test_directory_from_python' if not client.check(new_dir): client.mkdir(new_dir) print(f"Directory '{new_dir}' created.") else: print(f"Directory '{new_dir}' already exists.") # Example 3: Upload a file (assuming 'local_file.txt' exists) # with open('local_file.txt', 'rb') as f: # client.upload_file('remote_file.txt', f) # print("File uploaded.") except Exception as e: print(f"An error occurred: {e}")
Debug
Known issues
gotchaIn versions prior to `3.14.7`, inconsistent path quoting for `webdav.root` and URN handling could lead to `RemoteResourceNotFound` errors or incorrect file operations. Ensure your `webdav_hostname` is consistently formatted, especially regarding trailing slashes.
fix
Upgrade to `webdavclient3==3.14.7` or later. Carefully review and test path constructions, ensuring consistent quoting and proper `webdav_hostname` configuration.
affects: <3.14.7
gotchaOlder versions of `webdavclient3` could raise a `KeyError` if the HTTP response from the WebDAV server was missing the `Content-Length` header, which might occur with certain server implementations or empty files.
fix
Upgrade to `webdavclient3==3.14.7` or later, which includes a fix for this issue.
affects: <3.14.7
gotchaFrequent `RemoteResourceNotFound` errors can occur, particularly with services like Nextcloud or when the `webdav_hostname` is not precisely configured. Sometimes the base URL needs to include specific paths (e.g., `remote.php/dav/files/<username>`), or API calls like `client.list()` might require the username in the path (e.g., `client.list('/username/')`). Disabling checks (`client.webdav.disable_check = True`) might work as a workaround but should be used cautiously.
fix
Verify the exact `webdav_hostname` format required by your specific WebDAV server. Consult the server's documentation for pathing conventions. Experiment with including user-specific paths in the `webdav_hostname` or directly in method calls.
affects: All versions
gotchaIf your WebDAV server requires HTTP Digest Authentication, using `webdavclient3` with default options (which rely on `requests`'s basic authentication) may result in `401 Unauthorized` errors. `requests` does not handle Digest Auth automatically without explicit configuration.
fix
You may need to manually configure `requests` to use `HTTPDigestAuth` within the client's session, or switch the WebDAV server to use HTTP Basic Authentication if securely appropriate.
affects: All versions
gotchaSetting `client.verify = False` disables SSL certificate verification. While useful for testing with self-signed certificates, this can expose your application to man-in-the-middle attacks in production environments.
fix
Avoid `client.verify = False` in production. Ensure your WebDAV server uses a valid, trusted SSL certificate. If using a custom CA, configure the `requests` session (accessed via `client.session`) to trust your certificate bundle.
affects: All versions
Errors
Common errors & fixes
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url:
The provided username or password for the WebDAV server is incorrect, or the authenticated user lacks sufficient permissions for the requested operation.
fix
Ensure the `auth` parameter when initializing `Client` uses the correct `(username, password)` tuple for the WebDAV server, and verify the user's access rights.
webdavclient3.exceptions.RemoteResourceNotFound: Resource not found at '/path/to/nonexistent/file.txt'
The specified path or resource does not exist on the WebDAV server, or the path provided to the `webdavclient3` operation is incorrect.
fix
Verify the exact path of the file or directory on the WebDAV server, or use `client.exists(remote_path)` to check for its presence before attempting operations like download or delete.
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteHostClosedError('Remote host closed connection without response'))
The client failed to establish a network connection with the WebDAV server, possibly due to an incorrect URL, the server being down, network issues, or a firewall blocking access.
fix
Check the `base_url` for typos, ensure the WebDAV server is running and accessible, and verify network connectivity and firewall settings.
ModuleNotFoundError: No module named 'webdavclient'
The user attempted to import a module named `webdavclient`, but the installed library is named `webdavclient3`.
fix
Replace `webdavclient` with `webdavclient3` in your import statements, as `webdavclient3` is the correct package name.
Upgrade
Version history
3.14.7latest on PyPI · released Feb 6, 2026
Audit
Dependencies
requestsrequiredUsed for underlying HTTP communication.
lxmlrequiredUsed for parsing XML responses from WebDAV servers.
python-dateutilrequiredUsed for parsing date-related information in WebDAV responses.
Agent activity
72 hits · last 30 days
node
66
OpenAI (training)
1
Resources
webdavclient3 — pip install webdavclient3 · libregistry