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

URI Too Long #40

Open
beliaev-maksim opened this issue Aug 4, 2023 · 0 comments
Open

URI Too Long #40

beliaev-maksim opened this issue Aug 4, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@beliaev-maksim
Copy link

Describe the bug
Cannot delete all rows, get exception.

Library can work on it and fix the behaviour by sending requests in chunks

To Reproduce
on sheet with >1000 rows

rows_to_delete = [row.id_ for row in sheet.rows]

sheet.delete_rows(rows_to_delete)

Expected behavior
All rows deleted

Environment (please complete the following information):

  • Smartsheet Python SDK Version [3.0.2]
  • Python Version [3.10]

trace:

{"response": {"statusCode": 414, "reason": "URI Too Long", "content": "<< text/html; charset=iso-8859-1 content type suppressed >>"}}
Traceback (most recent call last):
  File "/home/maksim/git/smartsheet/venv/lib/python3.10/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.10/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/maksim/git/smartsheet/main.py", line 36, in <module>
    sheet.delete_rows(rows_to_delete)
  File "/home/maksim/git/smartsheet/venv/lib/python3.10/site-packages/smartsheet/models/sheet.py", line 372, in delete_rows
    return self._base.Sheets.delete_rows(self.id, object_ids, ignore_rows_not_found)
  File "/home/maksim/git/smartsheet/venv/lib/python3.10/site-packages/smartsheet/sheets.py", line 309, in delete_rows
    response = self._base.request(prepped_request, expected, _op)
  File "/home/maksim/git/smartsheet/venv/lib/python3.10/site-packages/smartsheet/smartsheet.py", line 255, in request
    res = self.request_with_retry(prepped_request, operation)
  File "/home/maksim/git/smartsheet/venv/lib/python3.10/site-packages/smartsheet/smartsheet.py", line 363, in request_with_retry
    native = result.native("Error")
  File "/home/maksim/git/smartsheet/venv/lib/python3.10/site-packages/smartsheet/smartsheet.py", line 616, in native
    error_payload = self.resp.json()
  File "/home/maksim/git/smartsheet/venv/lib/python3.10/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Process finished with exit code 1
@beliaev-maksim beliaev-maksim added the bug Something isn't working label Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant