I try to download a file from a Netfile "Data Room" which is a WebDAV share. The URL is https://webdav.netfiles.de//projectfiles. When using other WebDAV clients such as Gnome's Files application, I am able to list the directory and upload/download files. Unfortunately doing so using webdav4 fails.
I can show the file content (ls) but when trying to access that file I get a "not found" error:
$ ./get_netfiles.py
This works: client.ls('/hallo.txt') [{'name': 'hallo.txt', 'href': 'https://webdav.netfiles.de/***changed***/projectfiles/hallo.txt', 'content_length': 12, 'created': datetime.datetime(2022, 10, 26, 15, 46, 10, tzinfo=tzutc()), 'modified': datetime.datetime(2022, 10, 26, 15, 46, 10, tzinfo=datetime.timezone.utc), 'content_language': None, 'content_type': 'text/plain; charset=utf-8', 'etag': '"36b787591eb370bb0c9047dc1e2e6e20"', 'type': 'file', 'display_name': 'hallo.txt'}]
Traceback (most recent call last):
File "/home/beccon/Python/./get_netfiles.py", line 9, in <module>
print ("This fails: client.content_type('/hallo.txt')" , netfile_client.content_type("/hallo.txt"))
File "/usr/local/lib/python3.10/dist-packages/webdav4/client.py", line 581, in content_type
return self.get_props(path, "content_type").content_type
File "/usr/local/lib/python3.10/dist-packages/webdav4/client.py", line 334, in get_props
result = self.propfind(path, headers=headers, data=data)
File "/usr/local/lib/python3.10/dist-packages/webdav4/client.py", line 318, in propfind
http_resp = self.with_retry(call)
File "/usr/local/lib/python3.10/dist-packages/webdav4/func_utils.py", line 44, in wrapped_function
return func()
File "/usr/local/lib/python3.10/dist-packages/webdav4/func_utils.py", line 68, in wrapped
return func(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/webdav4/client.py", line 365, in _request
raise ResourceNotFound(path)
webdav4.client.ResourceNotFound: The resource /hallo.txt could not be found in the server
The same happens when I use the cli command dav.
For some strange reason everything works fine when I connect to Nextcloud. There I can list the directory, show file attributes, upload and download:
./get_nextcloud.py
This works [{'name': 'hallo.txt', 'href': '/nextcloud/remote.php/dav/files/test001/hallo.txt', 'content_length': 17, 'created': None, 'modified': datetime.datetime(2022, 10, 26, 17, 55, 57, tzinfo=datetime.timezone.utc), 'content_language': None, 'content_type': 'text/plain', 'etag': '"dbcd4f45a05b94992167db7b36b0838b"', 'type': 'file', 'display_name': None}]
This works also text/plain
Upload
Download
An interesting difference is that in Nexcloud the href does not contain an FQDN.
I try to download a file from a Netfile "Data Room" which is a WebDAV share. The URL is https://webdav.netfiles.de//projectfiles. When using other WebDAV clients such as Gnome's Files application, I am able to list the directory and upload/download files. Unfortunately doing so using webdav4 fails.
I can show the file content (ls) but when trying to access that file I get a "not found" error:
results in:
The same happens when I use the cli command dav.
For some strange reason everything works fine when I connect to Nextcloud. There I can list the directory, show file attributes, upload and download:
An interesting difference is that in Nexcloud the href does not contain an FQDN.