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

oc.share_file_with_link() raising 996 error #284

Open
garciamaxime opened this issue Aug 11, 2023 · 2 comments
Open

oc.share_file_with_link() raising 996 error #284

garciamaxime opened this issue Aug 11, 2023 · 2 comments

Comments

@garciamaxime
Copy link

Hi all,

I'm trying to automatically create share links to videofiles stored on my owncloud account (see script further down). Connection to the ownCloud server and extraction of filenames stored in the directory of interest work fine. Now when I run the oc.share_file_with_link() function (on a file path that is recognized on the server), I run into the following error message:

"Traceback (most recent call last):
File "", line 1, in
File "C:\Users..\pyocclient\owncloud\owncloud.py", line 904, in share_file_with_link
self._check_ocs_status(tree)
File "C:\Users..\pyocclient\owncloud\owncloud.py", line 1740, in _check_ocs_status
raise OCSResponseError(r)
owncloud.owncloud.OCSResponseError: OCS error: 996
"

I'm aware of similar issues, namely #218 #259 and #263, yet nothing in these threads could help me (I tried) probably coz the error they address is a 'NoneType' object has no attribute 'text', while mine is this 'raise OCSResponseError(r)
owncloud.owncloud.OCSResponseError: OCS error: 996'.

I've spent days trying all I could but am stuck, any help would be SUPER appreciated! Thanks much in advance.
Max

PS1: maybe unrelated but in case that speaks to anyone, I get a 'WARNING: Ignoring invalid distribution -yocclient' when running the 'pip install requests' of the manual installation procedure. Then the rest of the procedure (
$ git clone https://github.com/owncloud/pyocclient.git
$ cd pyocclient
$ python setup.py install
) runs fine.

PS2: The script in case that helps:
python
import owncloud
import csv

ownCloud server credentials

server_url = 'https://owncloud-bigdata.fibl.org'
username = 'myname'
password = 'mypwd'

Folder path and public link base URL

folder_path = 'Test_Videos_SchweinErleben'
public_link_base_url = 'https://owncloud-bigdata.fibl.org/index.php/s/uD6pNUE0U9Om8Pn'

Connect to the ownCloud server

oc = owncloud.Client(server_url)
oc.login(username, password)

Get the folder contents

folder_contents = oc.list(folder_path)

Define the path to save the CSV file

csv_file_path = 'C:/Users/../Desktop/test.csv'

Create a CSV file

with open(csv_file_path, 'w', newline='') as csv_file:
writer = csv.writer(csv_file)
writer.writerow(['File', 'Public Link'])
# Iterate through files in the folder
for file_info in folder_contents:
if not file_info.is_dir():
file_name = file_info.get_name()
file_path = folder_path + '/' + file_name
print(file_path)
# Generate public link for the file
public_link_url = oc.share_file_with_link(file_path)
# Write file name and public link to the CSV file
writer.writerow([file_name, public_link_url])

Disconnect from the ownCloud server

oc.logout()

@adebuhr
Copy link

adebuhr commented Oct 11, 2023

Hello,
same Problem here.

Hope that someone could fix it.

Thank you.

@lathass-123
Copy link

I am getting same.

"Traceback (most recent call last):
File "", line 1, in
File "C:\Users..\pyocclient\owncloud\owncloud.py", line 904, in share_file_with_link
self._check_ocs_status(tree)
File "C:\Users..\pyocclient\owncloud\owncloud.py", line 1740, in _check_ocs_status
raise OCSResponseError(r)
owncloud.owncloud.OCSResponseError: OCS error: 996

is there any solution?
I used pyocclient both 0.4 and 0.6. But getting same error. Can anyone help?

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

3 participants