from webdav4.fsspec import WebdavFileSystem
from webdav4.client import Client
client = Client("http://localhost:5244/dav", auth=("admin", "admin"))
fs = WebdavFileSystem(client=client)
like this which raised
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/root/.pyenv/versions/3.11.4/lib/python3.11/site-packages/fsspec/spec.py", line 81, in __call__
obj = super().__call__(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: WebdavFileSystem.__init__() missing 1 required positional argument: 'base_url'
Change:
class WebdavFileSystem(AbstractFileSystem):
"""Provides access to webdav through fsspec-compliant APIs."""
protocol = ("webdav", "dav")
def __init__(
self,
base_url: Optional["URLTypes"] = None,
auth: Optional["AuthTypes"] = None,
client: Optional["Client"] = None,
**client_opts: Any,
) -> None:
"""Instantiate WebdavFileSystem with base_url and auth.
Args:
base_url: base url of the server
auth: Authentication to the server
Refer to HTTPX's auth for more information.
client: Webdav client to use instead, useful for testing/mocking,
or extending WebdavFileSystem.
client_opts: Extra args that are passed to Webdav Client.
(refer to it's documenting for more information).
"""
super().__init__()
client_opts.setdefault("chunk_size", self.blocksize)
if not base_url and not client:
raise ValueError("Either base_url or client must be provided")
self.client = client or Client(base_url, auth=auth, **client_opts)
like this which raised
Change: