Skip to content

Error 401 when trying to do operations in shared folder that is password protected.  #282

@Attackly

Description

@Attackly

Hey,

when i want to access a password protected share like this

oc = owncloud.Client.from_public_link(theHost, folder_password=thepassword)
oc.list("")

I recive this error:

Traceback (most recent call last):
  File "C:\Users\me\PycharmProjects\pyocclienttest\main.py", line 4, in <module>
    oc.list("")
  File "C:\Users\me\PycharmProjects\pyocclienttest\venv\Lib\site-packages\owncloud\owncloud.py", line 469, in list
    res = self._make_dav_request('PROPFIND', path, headers=headers, data=data)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\me\PycharmProjects\pyocclienttest\venv\Lib\site-packages\owncloud\owncloud.py", line 1815, in _make_dav_request
    raise HTTPResponseError(res)
owncloud.owncloud.HTTPResponseError: HTTP error: 401

I have fiddled around a bit.
I got it to work by adding this header to the list and get_file function.
headers={"X-Requested-With" : "XMLHttpRequest"}

Does someone have the same problem or can confirm it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions