Skip to content

Commit 4c79a41

Browse files
authored
Merge pull request #94 from ParclLabs/fix/limit-bug
fix bug in limit check
2 parents c43499a + f55b9ee commit 4c79a41

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### v1.15.2
2+
- Update `property_v2.search` to fix limit logic bug.
3+
14
### v1.15.1
25
- Fix bug where `OTHER` property type was not being allowed in the `property_types` parameter in the `property_v2.search` endpoint.
36

parcllabs/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = "1.15.1"
1+
VERSION = "1.15.2"

parcllabs/services/properties/property_v2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ def _fetch_post(self, params: dict[str, Any], data: dict[str, Any]) -> list[dict
3838
if pagination:
3939
limit = pagination.get("limit")
4040
returned_count = metadata.get("results", {}).get("returned_count", 0)
41-
if returned_count < limit: # if we got fewer results than requested, don't paginate
41+
# if we got fewer or equal results than requested, don't paginate
42+
if returned_count <= limit:
4243
return all_data
4344

4445
# If we need to paginate, use concurrent requests

tests/test_property_v2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ def test_fetch_post_pagination(mock_post: Mock, property_v2_service: PropertyV2S
253253

254254
result = property_v2_service._fetch_post(params={"limit": 1}, data={})
255255

256-
assert len(result) == 2
256+
assert len(result) == 1
257257
assert result[0]["data"][0]["parcl_id"] == 123
258-
assert mock_post.call_count == 2
258+
assert mock_post.call_count == 1
259259

260260

261261
def test_as_pd_dataframe(property_v2_service: PropertyV2Service, mock_response: Mock) -> None:

0 commit comments

Comments
 (0)