Skip to content

Commit f83389f

Browse files
authored
Merge pull request #90 from ParclLabs/fix/pagination-v2
Fix/pagination v2
2 parents ea5a82c + 3dba516 commit f83389f

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-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.14.5
2+
- Update `property_v2.search` to fix pagination logic bug.
3+
14
### v1.14.4
25
- Internal code improvements.
36

parcllabs/__version__.py

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

parcllabs/services/properties/property_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def _fetch_post(self, params: dict[str, Any], data: dict[str, Any]) -> list[dict
2828

2929
if pagination:
3030
limit = pagination.get("limit")
31-
if returned_count == limit:
31+
if returned_count < limit: # if we got fewer results than requested, don't paginate
3232
return all_data
3333

3434
# 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
@@ -252,9 +252,9 @@ def test_fetch_post_pagination(mock_post: Mock, property_v2_service: PropertyV2S
252252

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

255-
assert len(result) == 1
255+
assert len(result) == 2
256256
assert result[0]["data"][0]["parcl_id"] == 123
257-
assert mock_post.call_count == 1
257+
assert mock_post.call_count == 2
258258

259259

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

0 commit comments

Comments
 (0)