>>> from nextcloud import NextCloud
>>> nc = NextCloud(url, user, pwd)
>>> >>> nc.create_group_folder('Test folder')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/site-packages/nextcloud/api_wrappers/group_folders.py", line 40, in create_group_folder
return self.requester.post(data={"mountpoint": mountpoint})
File "/usr/lib/python3.8/site-packages/nextcloud/requester.py", line 16, in wrapper
return func(*args, **kwargs)
File "/usr/lib/python3.8/site-packages/nextcloud/requester.py", line 54, in post
return self.rtn(res)
File "/usr/lib/python3.8/site-packages/nextcloud/requester.py", line 106, in rtn
return OCSResponse(response=resp,
File "/usr/lib/python3.8/site-packages/nextcloud/response.py", line 52, in __init__
self.full_data = response.json()
File "/usr/lib/python3.8/site-packages/requests/models.py", line 898, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.8/site-packages/simplejson/__init__.py", line 525, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.8/site-packages/simplejson/decoder.py", line 370, in decode
obj, end = self.raw_decode(s)
File "/usr/lib/python3.8/site-packages/simplejson/decoder.py", line 400, in raw_decode
return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
After some debugging it looks like the response sent by the server looks like this:
However, the OCSRequester treats the output as a JSON and it breaks.
I believe that some methods return XML regardless of the format=json parameter on the request, and the library should probably be robust enough to detect such cases and parse the response appropriately.
Example:
After some debugging it looks like the response sent by the server looks like this:
However, the
OCSRequester
treats the output as a JSON and it breaks.I believe that some methods return XML regardless of the
format=json
parameter on the request, and the library should probably be robust enough to detect such cases and parse the response appropriately.