From 74403e19a89a99a766c922c7abd1e8c7d672b981 Mon Sep 17 00:00:00 2001 From: Ivar Stangeby Date: Mon, 22 Feb 2021 13:53:06 +0100 Subject: [PATCH 1/2] Added test for whether `limit==0` in `APIClient._list_generator`. --- cognite/client/_api_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cognite/client/_api_client.py b/cognite/client/_api_client.py index 15e53c04c..37b1ae421 100644 --- a/cognite/client/_api_client.py +++ b/cognite/client/_api_client.py @@ -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 From fc3c9b87c69b35f53ccc3cbf4a29cb3304bea26c Mon Sep 17 00:00:00 2001 From: Ivar Stangeby Date: Mon, 22 Feb 2021 15:28:15 +0100 Subject: [PATCH 2/2] Updated version. --- CHANGELOG.md | 5 +++++ cognite/client/__init__.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 31cfb38ff..d98a5c4ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/cognite/client/__init__.py b/cognite/client/__init__.py index bab0385d0..3c7f3b177 100644 --- a/cognite/client/__init__.py +++ b/cognite/client/__init__.py @@ -1,3 +1,3 @@ from cognite.client._cognite_client import CogniteClient -__version__ = "2.11.1" +__version__ = "2.12.0"