WebDavClient

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) → None[source]

Download everything below remote_base_path into local_base_path, keeping the folder structure.

download_files(global_remote_base_path: str, remote_base_path: str, local_base_path: str) → None[source]

Download the files directly below remote_base_path, without subfolders.

Parameters:
  • global_remote_base_path – Root folder the local folder structure is relative to.

  • remote_base_path – Remote folder whose files are downloaded.

  • local_base_path – Local folder the files land under.

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.