Registry / http-networking / webdav4

webdav4

JSON →
library0.11.0pypypiunverified

webdav4 is a modern Python library for interacting with WebDAV servers, providing both a low-level client (`WebdavClient`) and an `fsspec`-compatible filesystem (`WebdavFS`). It is currently at version 0.11.0 and is actively maintained, with regular releases addressing features and bug fixes. It aims to offer a robust and user-friendly way to manage files on WebDAV resources.

pip install webdav4
INSTALL
IMPORT
SIG · WEBDAV4
W
webdav4
http-networkingpythonv0.11.0
Install
2.3s avg
Import
Disk
21MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.11.0 · 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.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 23.1MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.3s · import 0.000s · 24MB
21MB installed
● package 21MB
Code
Verified usage

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

WebdavClient
from webdav4 import WebdavClient
from webdav4.client import WebdavClient
WebdavFS
from webdav4 import WebdavFS

This quickstart demonstrates how to initialize `WebdavFS`, list directory contents, create a new directory, and write/read a file. Remember to replace placeholder credentials with your actual WebDAV server details or set them as environment variables. SSL verification might need to be disabled for servers with self-signed certificates.

import os from webdav4.fs import WebdavFS # Replace with your WebDAV server details or set as environment variables WEBDAV_URL = os.environ.get('WEBDAV_URL', 'http://localhost:8000/webdav/') WEBDAV_USER = os.environ.get('WEBDAV_USER', 'user') WEBDAV_PASS = os.environ.get('WEBDAV_PASS', 'password') if not all([WEBDAV_URL, WEBDAV_USER, WEBDAV_PASS]): print("Please set WEBDAV_URL, WEBDAV_USER, WEBDAV_PASS environment variables or update the script.") exit(1) try: # Initialize WebdavFS # For self-signed certificates or HTTP, you might need to add verify=False fs = WebdavFS( url=WEBDAV_URL, username=WEBDAV_USER, password=WEBDAV_PASS, # verify=False # Uncomment if you have SSL certificate issues ) print(f"Connecting to WebDAV server: {WEBDAV_URL}") # List contents of the root directory print(f"Listing contents of '/':") for item in fs.ls('/', detail=True): print(f" - {item['name']} (Type: {item['type']}, Size: {item.get('size', 'N/A')})") # Example: Create a directory test_dir_name = 'my_test_dir_webdav4' if not fs.exists(test_dir_name): fs.mkdir(test_dir_name) print(f"Successfully created directory: {test_dir_name}") else: print(f"Directory '{test_dir_name}' already exists.") # Example: Write and read a file test_file_path = f'{test_dir_name}/hello.txt' file_content = 'Hello, WebDAV4!' with fs.open(test_file_path, 'wb') as f: f.write(file_content.encode('utf-8')) print(f"Wrote content to {test_file_path}") with fs.open(test_file_path, 'rb') as f: read_content = f.read().decode('utf-8') print(f"Read content from {test_file_path}: '{read_content}'") # Clean up (optional) # fs.rm(test_file_path) # print(f"Removed file: {test_file_path}") # fs.rmdir(test_dir_name) # print(f"Removed directory: {test_dir_name}") except Exception as e: print(f"\nAn error occurred: {e}") print("Please ensure the WebDAV server is running and accessible, ") print("and that WEBDAV_URL, WEBDAV_USER, WEBDAV_PASS environment variables are set correctly.") print("If you are facing SSL issues, try adding `verify=False` to the WebdavFS constructor.")
Debug
Known issues
breakingThe package name was changed from `webdav` to `webdav4` starting with version 0.10.0. Projects using `import webdav` will fail with a `ModuleNotFoundError`.
fix
Uninstall the old package (`pip uninstall webdav` if installed), install the new one (`pip install webdav4`), and update all import statements to use `webdav4` (e.g., `from webdav4.client import WebdavClient`).
affects: 0.10.0+
breakingThe constructor signatures for `WebdavClient` and `WebdavFS` underwent significant changes in version 0.10.0. Specifically, `WebdavClient` now uses `base_url` instead of `url`, and the handling of authentication arguments has been refactored.
fix
Review the latest documentation for `WebdavClient` and `WebdavFS` constructor arguments. For `WebdavFS`, pass the full URL to `url` and credentials directly as `username` and `password`. For `WebdavClient`, use `base_url` and `username`/`password`.
affects: >=0.10.0
gotchaConnecting to WebDAV servers with self-signed SSL certificates or untrusted Certificate Authorities (CAs) will cause `ssl.SSLCertVerificationError` by default due to strict certificate validation.
fix
To bypass certificate verification (use with caution and only for development/testing), pass `verify=False` to the `WebdavClient` or `WebdavFS` constructor, e.g., `WebdavFS(url=..., username=..., password=..., verify=False)`.
affects: All
gotchaWhen using `fsspec` directly to create a filesystem, ensure you use the `webdav` or `webdavs` protocol handler. The `url` parameter for direct `WebdavFS` instantiation expects `http://` or `https://` URLs, but `fsspec.open` expects `webdav://` or `webdavs://`.
fix
For direct `WebdavFS` instantiation, use `WebdavFS(url='https://example.com/webdav/')`. For `fsspec.filesystem` or `fsspec.open`, use `fsspec.filesystem('webdav', url='webdavs://example.com/webdav/')` or `fsspec.open('webdavs://example.com/webdav/path/to/file', ...)`. Note that `fsspec.filesystem` often expects an `url` argument, but it's used for the *fsspec* URL, not the base_url.
affects: All
Upgrade
Version history
0.11.0latest on PyPI · released Feb 19, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
31 hits · last 30 days
node
26
OpenAI (training)
1
Resources
webdav4 — pip install webdav4 · libregistry