Skip to content

oc.share_file_with_link() raising 996 error #284

@garciamaxime

Description

@garciamaxime

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()

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