### Install webdavclient on macOS Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Installs the webdavclient package on macOS, which involves downloading and running the ez_setup.py script for setuptools and then installing the package. ```bash curl https://bootstrap.pypa.io/ez_setup.py -o - | python python setup.py install --prefix=/opt/setuptools sudo easy_install webdavclient ``` -------------------------------- ### Install webdavclient on macOS Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Installs setuptools and the webdavclient package on macOS using curl and easy_install. ```bash $ curl https://bootstrap.pypa.io/ez_setup.py -o - | python $ python setup.py install --prefix=/opt/setuptools $ sudo easy_install webdavclient ``` -------------------------------- ### Install webdavclient using apt-get Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Installs necessary development libraries and the webdavclient package using apt-get on Linux systems. ```bash $ sudo apt-get install libxml2-dev libxslt-dev python-dev $ sudo apt-get install libcurl4-openssl-dev python-pycurl $ sudo easy_install webdavclient ``` -------------------------------- ### Install webdavclient on Linux Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Installs the webdavclient package on Linux systems, including necessary dependencies like libxml2-dev, libxslt-dev, python-dev, libcurl4-openssl-dev, and python-pycurl. ```bash sudo apt-get install libxml2-dev libxslt-dev python-dev sudo apt-get install libcurl4-openssl-dev python-pycurl sudo easy_install webdavclient ``` -------------------------------- ### WebDAV Server Configuration Example Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Shows a YAML configuration snippet for connecting to various WebDAV-supported cloud storage services like Yandex.Disk, Dropbox, and Google Drive. Includes hostnames, logins, passwords, and specific root paths where applicable. ```yaml webdav-servers: - yandex hostname: https://webdav.yandex.ru login: #login_for_yandex password: #pass_for_yandex - dropbox hostname: https://dav.dropdav.com login: #login_for dropdav password: #pass_for_dropdav - google hostname: https://dav-pocket.appspot.com root: docso login: #login_for_dav-pocket password: #pass_for_dav-pocket - box hostname: https://dav.box.com root: dav login: #login_for_box password: #pass_for_box - 4shared hostname: https://webdav.4shared.com login: #login_for_4shared password: #pass_for_4shared ``` -------------------------------- ### Enable Bash Autocompletion (Bash) Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst These bash commands guide users on installing and enabling command-line autocompletion for the webdavclient using Homebrew on macOS or similar package managers on Unix-like systems. It involves updating bash, installing bash-completion, and activating autocompletion globally or locally. ```bash $ brew install bash $ chsh $ brew install bash-completion ``` ```bash #.bashrc eval "$(register-python-argcomplete wdc)" ``` ```bash $ sudo activate-global-python-argcomplete ``` -------------------------------- ### wdc CLI: Utility Commands Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Provides examples of common `wdc` utility commands for file and directory management. This includes checking file existence, freeing up space, listing directories, creating directories, copying, moving, downloading, uploading, publishing, and unpublishing files/directories. ```bash $ wdc check success $ wdc check file1 not success $ wdc free 245234120344 $ wdc ls dir1 file1 ... fileN $ wdc mkdir dir2 $ wdc copy dir1/file1 -t dir2/file1 $ wdc move dir2/file1 -t dir2/file2 $ wdc download dir1/file1 -t ~/Downloads/file1 $ wdc download dir1/ -t ~/Downloads/dir1/ $ wdc upload dir2/file2 -f ~/Documents/file1 $ wdc upload dir2/ -f ~/Documents/ $ wdc publish di2/file2 https://yadi.sk/i/vWtTUcBucAc6k $ wdc unpublish dir2/file2 $ wdc pull dir1/ -t ~/Documents/dir1/ $ wdc push dir1/ -f ~/Documents/dir1/ $ wdc info dir1/file1 {'name': 'file1', 'modified': 'Thu, 23 Oct 2014 16:16:37 GMT', 'size': '3460064', 'created': '2014-10-23T16:16:37Z'} ``` -------------------------------- ### wdc: Basic and OAuth Authentication Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Provides examples of authenticating with a WebDAV server using the 'wdc' command-line utility. Supports both basic authentication with username/password and OAuth token-based authentication. ```bash $ wdc login https://wedbav.server.ru -p http://127.0.0.1:8080 webdav_login: w_login webdav_password: w_password proxy_login: p_login proxy_password: p_password success $ wdc login https://wedbav.server.ru -p http://127.0.0.1:8080 --token xxxxxxxxxxxxxxxxxx proxy_login: p_login proxy_password: p_password success ``` -------------------------------- ### Get and Manipulate Resources Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Shows how to obtain a resource object and perform operations like renaming, moving, copying, getting information, reading from/to buffers, and reading/writing local files asynchronously. ```python # Get a resource res1 = client.resource("dir1/file1") # Work with the resource res1.rename("file2") res1.move("dir1/file2") res1.copy("dir2/file1") info = res1.info() res1.read_from(buffer) res1.read(local_path="~/Documents/file1") res1.read_async(local_path="~/Documents/file1", callback) res1.write_to(buffer) res1.write(local_path="~/Downloads/file1") res1.write_async(local_path="~/Downloads/file1", callback) ``` -------------------------------- ### Resource Operations: Get, Rename, Move, Copy, Read, Write Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Shows how to interact with individual resources via the client. This includes retrieving resource information, renaming, moving, copying, reading from/to buffers, and reading/writing to local files asynchronously or synchronously. ```python // Get a resource res1 = client.resource("dir1/file1") // Work with the resource res1.rename("file2") res1.move("dir1/file2") res1.copy("dir2/file1") info = res1.info() res1.read_from(buffer) res1.read(local_path="~/Documents/file1") res1.read_async(local_path="~/Documents/file1", callback) res1.write_to(buffer) res1.write(local_path="~/Downloads/file1") res1.write_async(local_path="~/Downloads/file1", callback) ``` -------------------------------- ### Get resource information Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Retrieves information about a specific resource (file or directory) on the WebDAV server. ```python # Get information about the resource client.info("dir1/file1") client.info("dir1/") ``` -------------------------------- ### Get resource information using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Retrieves metadata and information about a specific file or directory on the WebDAV server. ```python // Get information about the resource client.info("dir1/file1") client.info("dir1/") ``` -------------------------------- ### wdc: File and Directory Operations Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Demonstrates common file and directory operations using the 'wdc' command-line utility, including checking, freeing space, listing, creating directories, copying, moving, downloading, uploading, publishing, and unpublishing. ```bash $ wdc check success $ wdc check file1 not success $ wdc free 245234120344 $ wdc ls dir1 file1 ...fileN $ wdc mkdir dir2 $ wdc copy dir1/file1 -t dir2/file1 $ wdc move dir2/file1 -t dir2/file2 $ wdc download dir1/file1 -t ~/Downloads/file1 $ wdc download dir1/ -t ~/Downloads/dir1/ $ wdc upload dir2/file2 -f ~/Documents/file1 $ wdc upload dir2/ -f ~/Documents/ $ wdc publish di2/file2 https://yadi.sk/i/vWtTUcBucAc6k $ wdc unpublish dir2/file2 $ wdc pull dir1/ -t ~/Documents/dir1/ $ wdc push dir1/ -f ~/Documents/dir1/ $ wdc info dir1/file1 {'name': 'file1', 'modified': 'Thu, 23 Oct 2014 16:16:37 GMT', 'size': '3460064', 'created': '2014-10-23T16:16:37Z'} ``` -------------------------------- ### Configure WebDAV client with basic options Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Configures a WebDAV client instance with essential connection details including hostname, login, and password. ```python import webdav.client as wc options = { 'webdav_hostname': "https://webdav.server.ru", 'webdav_login': "login", 'webdav_password': "password" } client = wc.Client(options) ``` -------------------------------- ### wdc: Enabling Autocompletion for Bash Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Instructions for enabling command-line autocompletion for the 'wdc' utility on macOS using Homebrew and bash-completion. Covers global and local activation methods. ```bash $ brew install bash $ chsh $ brew install bash-completion # globally $ sudo activate-global-python-argcomplete # locally #.bashrc eval "$(register-python-argcomplete wdc)" ``` -------------------------------- ### wdc CLI: Basic Authentication Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Demonstrates how to log in to a WebDAV server using basic authentication via the `wdc` command-line utility. It prompts for WebDAV and proxy credentials. ```bash $ wdc login https://wedbav.server.ru -p http://127.0.0.1:8080 webdav_login: w_login webdav_password: w_password proxy_login: p_login proxy_password: p_password success ``` -------------------------------- ### Create a directory using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Creates a new directory on the WebDAV server at the specified path. ```python // Create directory client.mkdir("dir1/dir2") ``` -------------------------------- ### Configure WebDAV Servers (YAML) Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst This YAML configuration snippet defines connection settings for multiple WebDAV servers, including Yandex.Disk, DropBox, Google Drive, Box, and 4Shared. It specifies hostnames, login credentials, and optional root paths required for establishing connections. ```yaml webdav-servers: - yandex hostname: https://webdav.yandex.ru login: #login_for_yandex password: #pass_for_yandex - dropbox hostname: https://dav.dropdav.com login: #login_for dropdav password: #pass_for_dropdav - google hostname: https://dav-pocket.appspot.com root: docso login: #login_for_dav-pocket password: #pass_for_dav-pocket - box hostname: https://dav.box.com root: dav login: #login_for_box password: #pass_for_box - 4shared hostname: https://webdav.4shared.com login: #login_for_4shared password: #pass_for_4shared ``` -------------------------------- ### Create a directory Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Creates a new directory on the WebDAV server at the specified remote path. ```python # Create directory client.mkdir("dir1/dir2") ``` -------------------------------- ### Download Files and Directories Asynchronously Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Demonstrates asynchronous downloading of files and directories using the webdav client. Requires specifying remote and local paths, and optionally a callback function for progress updates. ```python kwargs = { 'remote_path': "dir1/file1", 'local_path': "~/Downloads/file1", 'callback': callback } client.download_async(**kwargs) kwargs = { 'remote_path': "dir1/dir2/", 'local_path': "~/Downloads/dir2/", 'callback': callback } client.download_async(**kwargs) ``` -------------------------------- ### Handle WebDAV exceptions Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Demonstrates how to catch and handle specific exceptions raised by the webdavclient library. ```python // Exception handling from webdav.client import WebDavException try: ... except WebDavException as exception: ... ``` -------------------------------- ### Handle WebDAV exceptions Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Demonstrates how to catch and handle specific WebDAV-related exceptions that may occur during operations. ```python # Exception handling from webdav.client import WebDavException try: ... except WebDavException as exception: ... ``` -------------------------------- ### Upload Files and Directories Asynchronously Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Illustrates asynchronous uploading of files and directories to a WebDAV server. Similar to downloading, it requires remote and local paths, and supports a callback for progress. ```python # Unload resource kwargs = { 'remote_path': "dir1/file1", 'local_path': "~/Downloads/file1", 'callback': callback } client.upload_async(**kwargs) kwargs = { 'remote_path': "dir1/dir2/", 'local_path': "~/Downloads/dir2/", 'callback': callback } client.upload_async(**kwargs) ``` -------------------------------- ### Update webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Updates the webdavclient package to the latest version using pip. ```bash sudo pip install -U webdavclient ``` -------------------------------- ### List resources in a directory using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Retrieves a list of files and directories from the root or a specified directory on the WebDAV server. ```python // Get a list of resources files1 = client.list() files2 = client.list("dir1") ``` -------------------------------- ### List resources in a directory Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Retrieves a list of files and directories within a specified directory on the WebDAV server. If no directory is specified, it lists resources in the root directory. ```python # Get a list of resources files1 = client.list() files2 = client.list("dir1") ``` -------------------------------- ### Download resources synchronously using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Downloads files or directories from the WebDAV server to the local machine synchronously. ```python // Move resource client.download_sync(remote_path="dir1/file1", local_path="~/Downloads/file1") client.download_sync(remote_path="dir1/dir2/", local_path="~/Downloads/dir2/") ``` -------------------------------- ### Configure WebDAV client with certificate path Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Configures a WebDAV client to use specific certificate and private key files for secure connections. ```python import webdav.client as wc options = { 'webdav_hostname': "https://webdav.server.ru", 'webdav_login': "w_login", 'webdav_password': "w_password", 'cert_path': "/etc/ssl/certs/certificate.crt", 'key_path': "/etc/ssl/private/certificate.key" } client = wc.Client(options) ``` -------------------------------- ### Download a resource synchronously Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Downloads a resource (file or directory) from the WebDAV server to a local path synchronously. ```python # Move resource client.download_sync(remote_path="dir1/file1", local_path="~/Downloads/file1") client.download_sync(remote_path="dir1/dir2/", local_path="~/Downloads/dir2/") ``` -------------------------------- ### Configure WebDAV client with speed limits and verbose mode Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Configures a WebDAV client with options to limit download and upload speeds (in Bytes per second) and to enable or disable verbose output. ```python options = { ... 'recv_speed' : 3000000, 'send_speed' : 3000000, 'verbose' : True } client = wc.Client(options) ``` -------------------------------- ### Copy a resource Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Copies a resource (file or directory) from a source path to a destination path on the WebDAV server. ```python # Copy resource client.copy(remote_path_from="dir1/file1", remote_path_to="dir2/file1") client.copy(remote_path_from="dir2", remote_path_to="dir3") ``` -------------------------------- ### Publish a resource Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Generates a public sharable link for a resource (file or directory) on the WebDAV server. ```python # Publish the resource link = client.publish("dir1/file1") link = client.publish("dir2") ``` -------------------------------- ### Asynchronous File Upload with Callback Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Illustrates asynchronous file uploads using the webdav client. It requires specifying the remote and local paths and an optional callback function for post-upload actions. ```python // Unload resource kwargs = { 'remote_path': "dir1/file1", 'local_path': "~/Downloads/file1", 'callback': callback } client.upload_async(**kwargs) kwargs = { 'remote_path': "dir1/dir2/", 'local_path': "~/Downloads/dir2/", 'callback': callback } client.upload_async(**kwargs) ``` -------------------------------- ### Configure WebDAV client with proxy settings Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Configures a WebDAV client to connect through a proxy server, specifying proxy hostname, login, and password along with WebDAV connection details. ```python import webdav.client as wc options = { 'webdav_hostname': "https://webdav.server.ru", 'webdav_login': "w_login", 'webdav_password': "w_password", 'proxy_hostname': "http://127.0.0.1:8080", 'proxy_login': "p_login", 'proxy_password': "p_password" } client = wc.Client(options) ``` -------------------------------- ### Publish resources using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Generates a public link for a file or directory on the WebDAV server. ```python // Publish the resource link = client.publish("dir1/file1") link = client.publish("dir2") ``` -------------------------------- ### Check free disk space Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Retrieves the amount of free space available on the WebDAV server. ```python # Check free space free_size = client.free() ``` -------------------------------- ### Upload a resource synchronously Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Uploads a local file or directory to the WebDAV server at the specified remote path synchronously. ```python # Unload resource client.upload_sync(remote_path="dir1/file1", local_path="~/Documents/file1") client.upload_sync(remote_path="dir1/dir2/", local_path="~/Documents/dir2/") ``` -------------------------------- ### Update webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Updates the webdavclient package to the latest version using pip. ```bash $ sudo pip install -U webdavclient ``` -------------------------------- ### Upload resources synchronously using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Uploads files or directories from the local machine to the WebDAV server synchronously. ```python // Unload resource client.upload_sync(remote_path="dir1/file1", local_path="~/Documents/file1") client.upload_sync(remote_path="dir1/dir2/", local_path="~/Documents/dir2/") ``` -------------------------------- ### wdc CLI: OAuth Token Authentication Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Shows how to authenticate with a WebDAV server using an OAuth token via the `wdc` CLI. This method bypasses interactive credential input for WebDAV authentication. ```bash $ wdc login https://wedbav.server.ru -p http://127.0.0.1:8080 --token xxxxxxxxxxxxxxxxxx proxy_login: p_login proxy_password: p_password success ``` -------------------------------- ### Check free space using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Retrieves the amount of free space available on the WebDAV server. ```python // Check free space free_size = client.free() ``` -------------------------------- ### Copy resources using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Copies a file or directory from one location to another on the WebDAV server. ```python // Copy resource client.copy(remote_path_from="dir1/file1", remote_path_to="dir2/file1") client.copy(remote_path_from="dir2", remote_path_to="dir3") ``` -------------------------------- ### Move resources using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Moves a file or directory from one location to another on the WebDAV server. ```python // Move resource client.move(remote_path_from="dir1/file1", remote_path_to="dir2/file1") client.move(remote_path_from="dir2", remote_path_to="dir3") ``` -------------------------------- ### Download missing files from remote to local Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Synchronizes local directory with a remote directory by downloading files that are missing locally. ```python # Get the missing files client.pull(remote_directory='dir1', local_directory='~/Documents/dir1') ``` -------------------------------- ### Move a resource Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Moves a resource (file or directory) from a source path to a destination path on the WebDAV server. ```python # Move resource client.move(remote_path_from="dir1/file1", remote_path_to="dir2/file1") client.move(remote_path_from="dir2", remote_path_to="dir3") ``` -------------------------------- ### Check resource existence Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Checks if a resource (file or directory) exists on the WebDAV server. ```python # Checking existence of the resource client.check("dir1/file1") client.check("dir1") ``` -------------------------------- ### Pull missing files using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Downloads files from a remote directory to a local directory if they are missing locally. ```python // Get the missing files client.pull(remote_directory='dir1', local_directory='~/Documents/dir1') ``` -------------------------------- ### Check resource existence using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Checks if a file or directory exists on the WebDAV server. ```python // Checking existence of the resource client.check("dir1/file1") client.check("dir1") ``` -------------------------------- ### Push missing files using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Uploads files from a local directory to a remote directory if they are missing remotely. ```python // Send missing files client.push(remote_directory='dir1', local_directory='~/Documents/dir1') ``` -------------------------------- ### Upload missing files from local to remote Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Synchronizes remote directory with a local directory by uploading files that are missing remotely. ```python # Send missing files client.push(remote_directory='dir1', local_directory='~/Documents/dir1') ``` -------------------------------- ### Unpublish a resource Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Removes the public sharable link for a resource (file or directory) on the WebDAV server. ```python # Unpublish resource client.unpublish("dir1/file1") client.unpublish("dir2") ``` -------------------------------- ### Delete a resource Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.md Deletes a resource (file or directory) from the WebDAV server at the specified remote path. ```python # Delete resource client.clean("dir1/dir2") ``` -------------------------------- ### Delete a resource using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Removes a file or directory from the WebDAV server. ```python // Delete resource client.clean("dir1/dir2") ``` -------------------------------- ### Unpublish resources using webdavclient Source: https://github.com/cloudpolis/webdav-client-python/blob/master/README.rst Revokes the public link for a file or directory on the WebDAV server. ```python // Unpublish resource client.unpublish("dir1/file1") client.unpublish("dir2") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.