Skip to content

WebDAV connection

Bases: FileConnection, RenameDirMixin

WebDAV file connection. |support_hooks|

Based on WebdavClient3 library <https://pypi.org/project/webdavclient3/>_.

.. warning::

Since onETL v0.7.0 to use WebDAV connector you should install package as follows:

.. code:: bash

    pip install "onetl[webdav]"

    # or
    pip install "onetl[files]"

See :ref:`install-files` installation instruction for more details.

.. versionadded:: 0.6.0

Parameters:

  • host (str) –

    Host of WebDAV source. For example: webdav.domain.com

  • user (str) –

    User, which have access to the file source. For example: someuser

  • password (str) –

    Password for file source connection

  • ssl_verify (Union[Path, bool]) –

    SSL certificates used to verify the identity of requested hosts. Can be any of - True (uses default CA bundle), - a path to an SSL certificate file, - False (disable verification), or - a :obj:ssl.SSLContext

  • protocol (str, default: : `https` ) –

    Connection protocol. Allowed values: https or http

  • port (int) –

    Connection port

Examples:

Create and check WebDAV connection:

.. code:: python

from onetl.connection import WebDAV

wd = WebDAV(
    host="webdav.domain.com",
    user="someuser",
    password="*****",
    protocol="https",
).check()

path_exists(path)

Check if specified path exists on remote filesystem. |support_hooks|.

.. versionadded:: 0.8.0

Parameters:

  • path (str | :obj:os.PathLike) –

    Path to check

Returns:

  • ``True`` if path exists, ``False`` otherwise

Examples:

>>> connection.path_exists("/path/to/file.csv")
True
>>> connection.path_exists("/path/to/dir")
True
>>> connection.path_exists("/path/to/missing")
False