diff --git a/CHANGELOG.md b/CHANGELOG.md index b4407ba..9a73d80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### v1.15.2 +- Update `property_v2.search` to fix limit logic bug. + ### v1.15.1 - Fix bug where `OTHER` property type was not being allowed in the `property_types` parameter in the `property_v2.search` endpoint. diff --git a/parcllabs/__version__.py b/parcllabs/__version__.py index 6b69db2..d7bd6a9 100644 --- a/parcllabs/__version__.py +++ b/parcllabs/__version__.py @@ -1 +1 @@ -VERSION = "1.15.1" +VERSION = "1.15.2" diff --git a/parcllabs/services/properties/property_v2.py b/parcllabs/services/properties/property_v2.py index 47a4367..54a9589 100644 --- a/parcllabs/services/properties/property_v2.py +++ b/parcllabs/services/properties/property_v2.py @@ -38,7 +38,8 @@ def _fetch_post(self, params: dict[str, Any], data: dict[str, Any]) -> list[dict if pagination: limit = pagination.get("limit") returned_count = metadata.get("results", {}).get("returned_count", 0) - if returned_count < limit: # if we got fewer results than requested, don't paginate + # if we got fewer or equal results than requested, don't paginate + if returned_count <= limit: return all_data # If we need to paginate, use concurrent requests diff --git a/tests/test_property_v2.py b/tests/test_property_v2.py index 81e3d27..7f460c2 100644 --- a/tests/test_property_v2.py +++ b/tests/test_property_v2.py @@ -253,9 +253,9 @@ def test_fetch_post_pagination(mock_post: Mock, property_v2_service: PropertyV2S result = property_v2_service._fetch_post(params={"limit": 1}, data={}) - assert len(result) == 2 + assert len(result) == 1 assert result[0]["data"][0]["parcl_id"] == 123 - assert mock_post.call_count == 2 + assert mock_post.call_count == 1 def test_as_pd_dataframe(property_v2_service: PropertyV2Service, mock_response: Mock) -> None: