Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemoteResourceNotFound - Cannot interact with files or directories in any meaningful capacity #114

Open
danastasio opened this issue Dec 20, 2021 · 6 comments

Comments

@danastasio
Copy link

danastasio commented Dec 20, 2021

Hello,

I am having an issue with this library where I cannot download resources or get information about them. I can connect to the webdav share, and list the files in a directory, but that is it.

This is my entire script. X represents a specific IP address

from webdav3.client import Client
from settings import Settings

options = { 
    'webdav_hostname': Settings.hostname,
    'webdav_login': Settings.username,
    'webdav_password': Settings.password,
    'disable_check': True,
    'webdav_root': "/",
    'webdav_override_methods' : {
        'check': "GET",
    }
}

client = Client(options)
print("The files in the directory are:")
print(client.list("2021/12/13/15"))
print("Getting a single resource")
res1 = client.resource("2021/12/13/15/2021.12.13.15.ip-X.txt.gz")
print("Trying to print info")
print(res1.info())
res1.write(local_path="~/Downloads/splunk_log.txt.gz")

Everything up to "Trying to print info" works swimmingly. client.list prints all of the files that I am expecting to see, res1 gets created properly. However, when I try and get info about res1 with res1.info(), I get a 404 resource not found error (even though the resource was already read). I also get this same error when I try and do client.pull(), or when I try any method at all to download the files.

The full output I'm getting is (again, X represents a specific IP address):

The files in the directory are: 
['15/', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz', '2021.12.13.15.ip-X.txt.gz']
Getting a single resource
Trying to print info
Traceback (most recent call last):
  File "/home/user/Projects/webdav/grab_files_from_webdav.py", line 21, in <module>
    print(res1.info())
  File "/home/user/Projects/webdav/lib64/python3.10/site-packages/webdav3/client.py", line 976, in info
    info = self.client.info(self.urn.path())
  File "/home/user/Projects/webdav/lib64/python3.10/site-packages/webdav3/client.py", line 67, in _wrapper
    res = fn(self, *args, **kw)
  File "/home/user/Projects/webdav/lib64/python3.10/site-packages/webdav3/client.py", line 762, in info
    return WebDavXmlUtils.parse_info_response(content=response.content, path=path, hostname=self.webdav.hostname)
  File "/home/user/Projects/webdav/lib64/python3.10/site-packages/webdav3/client.py", line 1152, in parse_info_response
    response = WebDavXmlUtils.extract_response_for_path(content=content, path=path, hostname=hostname)
  File "/home/user/Projects/webdav/lib64/python3.10/site-packages/webdav3/client.py", line 1251, in extract_response_for_path
    raise RemoteResourceNotFound(path)
webdav3.exceptions.RemoteResourceNotFound: Remote resource: /2021/12/13/15/2021.12.13.15.ip-X.txt.gz not found

I believe this is related to issue #27

Any help would be appreciated. Thanks!

@danastasio danastasio changed the title Cannot interact with files or directories in any meaningful capacity RemoteResourceNotFound - Cannot interact with files or directories in any meaningful capacity Dec 20, 2021
@czen
Copy link

czen commented Jun 9, 2022

Still unresolved. Can't download any files from Nextcloud using webdavclient3 3.14.6
Tried with https://github.com/CloudPolis/webdav-client-python, same problem.
Just calling client.execute_request('download', path) returns the correct 200 OK and the content of the file.
Nothing makes sense. Why does client.list return a list starting with the name of the innermost subdirectory?
Why does client.downlaod_file() work differently from client.execute_request with the same request type?

@Alanbrtd
Copy link

Hello,
Have you solved your problem ?

@Shahin-rmz
Copy link

I second this. Like to access my files inside nextcloud but it does not work.
webdav3.exceptions.RemoteResourceNotFound: Remote resource: /remote.php/dav/files/XXXX/YYYY/EXAMPLE.csv not found

@jkelley-blackboard
Copy link

jkelley-blackboard commented May 17, 2023

I have the same issue with a different WebDAV provider. Can't get past the root.
client.list("", get_info=True) returns the correct list that includes a directory "some_directory", but
client.list("some_directory", get_info=True) always returns RemoteResourceNotFound.

@BuckyI
Copy link

BuckyI commented Jul 30, 2023

I have the same issue with a different WebDAV provider. Can't get past the root. client.list("", get_info=True) returns the correct list that includes a directory "some_directory", but client.list("some_directory", get_info=True) always returns RemoteResourceNotFound.

same problem, but I set client.webdav.disable_check = True and it works fine :)

@lightheaded
Copy link

I have the same issue with a different WebDAV provider. Can't get past the root. client.list("", get_info=True) returns the correct list that includes a directory "some_directory", but client.list("some_directory", get_info=True) always returns RemoteResourceNotFound.

same problem, but I set client.webdav.disable_check = True and it works fine :)

Thanks! Adding client.webdav.disable_check = True worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants