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

Bug: limit=0 yields self._LIST_LIMIT instead of raising APIError #788

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [2.12.0] - 2021-02-22

### Changed
- Setting `limit=0` in list-endpoints should now correctly raise an API error instead of returning `LIST_LIMIT` number of items.

## [2.11.1] - 2021-02-18

### Changed
Expand Down
2 changes: 1 addition & 1 deletion cognite/client/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from cognite.client._cognite_client import CogniteClient

__version__ = "2.11.1"
__version__ = "2.12.0"
2 changes: 1 addition & 1 deletion cognite/client/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def _list_generator(
filter = filter or {}
current_items = []
while True:
if limit:
if limit or limit == 0:
num_of_remaining_items = limit - total_items_retrieved
if num_of_remaining_items < self._LIST_LIMIT:
current_limit = num_of_remaining_items
Expand Down