Skip to content

JSONDecodeError when trying to use ocs with groupfolders #277

@Luux

Description

@Luux
nc.ocs(method="GET", path="/apps/groupfolders/folders")

results in a JSONDecodeError:

Exception has occurred: JSONDecodeError
Expecting value: line 1 column 1 (char 0)
StopIteration: 0

During handling of the above exception, another exception occurred:

  File ".../nc_py_api/nc_py_api/_session.py", line 216, in ocs
    response_data = loads(response.text)
                    ^^^^^^^^^^^^^^^^^^^^
  File ".../nc_py_api/nc_py_api/nextcloud.py", line 144, in ocs
    return self._session.ocs(method, path, content=content, json=json, params=params, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../customer-data-nextcloud/nextcloud_api_test/nc-py-api.py", line 51, in <module>
    folders = nc.ocs(method="GET", path="/apps/groupfolders/folders")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Checking the response and also testing with curl, it seems that the server sends xml back per default. With curl, this can be fixed by adding -H "Accept: application/json" - this should be done per default in the ocs function as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixedFixed in last versionnc upstream issuewaiting for it to be fixed/implemented in the Nextcloud

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions