WebDavClient#

WebDAV client implementation for listing and downloading remote files.

class kataglyphis_webdavclient.webdavclient.WebDavClient(hostname: str, username: str, password: str)[source]#

Bases: object

A simple WebDav client for listing and downloading files and folders.

download_all_files_iterative(remote_base_path: str, local_base_path: str, *, extension: str | None = None) → int[source]#

Download a tree with an optional case-insensitive suffix; fail on any error and return the count.

download_files(global_remote_base_path: str, remote_base_path: str, local_base_path: str, *, extension: str | None = None) → int[source]#

Atomically download matching files, preserving paths below the global base; return the count.

ensure_folder_exists(path: str) → None[source]#

Ensure that the given folder exists.

filter_after_global_base_path(path: str, remote_base_path: str) → str[source]#

Return what follows /remote_base_path/ in path, or path unchanged when it is absent.

get_sub_path(full_path: str, initial_part: str) → str[source]#

Return the part of a host-less full_path after initial_part; ValueError when it is absent.

list_files(url: str) → list[str][source]#

List the files directly below a WebDAV URL; OSError unless PROPFIND answers 207.

list_folders(remote_base_path: str) → list[str][source]#

List the non-hidden folders directly below a remote base path; OSError unless PROPFIND answers 207.