or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

client-operations.mdconfiguration.mdfile-transfer.mdindex.mdresource-management.mdsynchronization.md
tile.json

tessl/pypi-webdavclient

WebDAV client library providing easy access to cloud storage services like Yandex.Drive, Dropbox, Google Drive, Box, and 4shared.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/webdavclient@1.0.x

To install, run

npx @tessl/cli install tessl/pypi-webdavclient@1.0.0

index.mddocs/

WebDAV Client

A comprehensive Python library providing easy and convenient access to WebDAV servers including cloud storage services like Yandex.Drive, Dropbox, Google Drive, Box, 4shared, and others. The package offers three main components: a webdav API for programmatic access, a resource API using object-oriented concepts, and a cross-platform command-line utility (wdc).

Package Information

  • Package Name: webdavclient
  • Language: Python
  • Installation: pip install webdavclient
  • Version: 1.0.8
  • Python Support: 2.6-2.7, 3.0-3.4

Core Imports

import webdav.client as wc

For specific classes and exceptions:

from webdav.client import Client, Resource
from webdav.exceptions import WebDavException

Basic Usage

import webdav.client as wc

# Configure client with WebDAV server credentials
options = {
    'webdav_hostname': "https://webdav.server.com",
    'webdav_login': "username", 
    'webdav_password': "password"
}
client = wc.Client(options)

# Basic file operations
client.check("remote/file.txt")  # Check if file exists
client.mkdir("remote/newfolder")  # Create directory
client.upload_sync("remote/file.txt", "local/file.txt")  # Upload file
client.download_sync("remote/file.txt", "local/file.txt")  # Download file

# Resource API for object-oriented operations
resource = client.resource("remote/file.txt")
resource.read("local/copy.txt")  # Download using resource
resource.write("local/upload.txt")  # Upload using resource

Architecture

The webdavclient architecture consists of three main layers:

  • Client API: Direct WebDAV operations with synchronous and asynchronous methods
  • Resource API: Object-oriented wrapper providing intuitive resource manipulation
  • Connection Layer: Configuration management with WebDAV and proxy settings
  • Utility Layer: URI handling, exceptions, and supporting functions

Capabilities

Client Operations

Core WebDAV client functionality providing all essential operations for interacting with WebDAV servers. Includes connection management, basic file operations, and advanced synchronization features.

class Client:
    def __init__(self, options: dict) -> None: ...
    def valid(self) -> bool: ...
    def check(self, remote_path: str = "/") -> bool: ...
    def list(self, remote_path: str = "/") -> list: ...
    def info(self, remote_path: str = "/") -> dict: ...
    def free(self) -> int: ...
    def mkdir(self, remote_path: str) -> None: ...
    def is_dir(self, remote_path: str) -> bool: ...
    def clean(self, remote_path: str) -> None: ...
    def copy(self, remote_path_from: str, remote_path_to: str) -> None: ...
    def move(self, remote_path_from: str, remote_path_to: str) -> None: ...
    def get_property(self, remote_path: str, option: dict) -> str: ...
    def set_property(self, remote_path: str, option: dict) -> None: ...
    def download_to(self, buff, remote_path: str) -> None: ...
    def upload_from(self, buff, remote_path: str) -> None: ...
    def publish(self, remote_path: str) -> str: ...
    def unpublish(self, remote_path: str) -> None: ...
    def resource(self, remote_path: str) -> Resource: ...

Client Operations

File Transfer

Upload and download operations with support for both synchronous and asynchronous execution, progress callbacks, and directory synchronization.

def download_sync(self, remote_path: str, local_path: str, callback=None) -> None: ...
def upload_sync(self, remote_path: str, local_path: str, callback=None) -> None: ...
def download_async(self, remote_path: str, local_path: str, callback=None) -> None: ...
def upload_async(self, remote_path: str, local_path: str, callback=None) -> None: ...

File Transfer

Resource Management

Object-oriented interface for WebDAV resources providing intuitive methods for file and directory operations, metadata access, and content manipulation.

class Resource:
    def __init__(self, client: Client, urn: str) -> None: ...
    def is_dir(self) -> bool: ...
    def check(self) -> bool: ...
    def info(self, params=None) -> dict: ...
    def clean(self) -> None: ...
    def rename(self, new_name: str) -> None: ...
    def move(self, remote_path: str) -> None: ...
    def copy(self, remote_path: str) -> Resource: ...
    def read_from(self, buff) -> None: ...
    def read(self, local_path: str) -> None: ...
    def read_async(self, local_path: str, callback=None) -> None: ...
    def write_to(self, buff) -> None: ...
    def write(self, local_path: str) -> None: ...
    def write_async(self, local_path: str, callback=None) -> None: ...
    def publish(self) -> str: ...
    def unpublish(self) -> None: ...
    @property
    def property(self) -> str: ...  # Property getter
    @property.setter
    def property(self, value) -> None: ...  # Property setter

Resource Management

Synchronization

Advanced directory synchronization capabilities for keeping local and remote directories in sync, with support for push, pull, and bidirectional synchronization.

def push(self, remote_directory: str, local_directory: str) -> None: ...
def pull(self, remote_directory: str, local_directory: str) -> None: ...
def sync(self, remote_directory: str, local_directory: str) -> None: ...

Synchronization

Metadata and Properties

WebDAV metadata and property operations for retrieving and setting custom properties on resources.

def get_property(self, remote_path: str, option: dict) -> str: ...
def set_property(self, remote_path: str, option: dict) -> None: ...

Configuration

WebDAV and proxy server configuration with comprehensive validation and SSL certificate support.

class WebDAVSettings:
    keys = {'hostname', 'login', 'password', 'token', 'root', 'cert_path', 'key_path', 'recv_speed', 'send_speed', 'verbose'}
    def __init__(self, options: dict) -> None: ...
    def is_valid(self) -> None: ...

class ProxySettings:
    keys = {'hostname', 'login', 'password'}
    def __init__(self, options: dict) -> None: ...

Configuration

Constants

# Module version
__version__ = "1.0.8"

# Client class constants  
class Client:
    root = '/'  # Default root directory
    large_size = 2 * 1024 * 1024 * 1024  # 2GB large file threshold

Types

# Exception hierarchy
class WebDavException(Exception): ...
class NotValid(WebDavException): ...
class OptionNotValid(NotValid): ...
class NotFound(WebDavException): ...
class LocalResourceNotFound(NotFound): ...
class RemoteResourceNotFound(NotFound): ...
class RemoteParentNotFound(NotFound): ...
class MethodNotSupported(WebDavException): ...
class NotConnection(WebDavException): ...
class NotEnoughSpace(WebDavException): ...
class CertificateNotValid(NotValid): ...

# Utility classes
class Urn:
    def __init__(self, path: str, directory: bool = False) -> None: ...
    def path(self) -> str: ...
    def quote(self) -> str: ...
    def filename(self) -> str: ...
    def parent(self) -> str: ...
    def nesting_level(self) -> int: ...
    def is_dir(self) -> bool: ...

# Module-level utility functions
def listdir(directory: str) -> list: ...  # Enhanced directory listing
def add_options(request, options: dict) -> None: ...  # Add pycurl options
def get_options(type, from_options: dict) -> dict: ...  # Extract typed options