From cd683502732c8a96e8bcaa820b57a096d0cbe515 Mon Sep 17 00:00:00 2001 From: Steven Maude Date: Tue, 10 Mar 2015 16:31:45 +0000 Subject: [PATCH] Stop paging listings after page 99 With a page size of 100, the API won't return results for page 100, page 99 is the last valid one. Known issue: http://developer.zoopla.com/forum/read/162309 --- zoopla/api_v1.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/zoopla/api_v1.py b/zoopla/api_v1.py index d0edc6b..f068a18 100644 --- a/zoopla/api_v1.py +++ b/zoopla/api_v1.py @@ -72,6 +72,9 @@ def _call_api_paged(self, command, args, max_results, result_processor): There are a few conditions where we need to stop paging 1) We've yielded max_results 2) We've yielded result_count + 3) We've reached page number 100 (with a page size of 100) + + 3 is by design; see http://developer.zoopla.com/forum/read/162309 """ num_yielded = 0 args['page_size'] = 100 @@ -92,6 +95,11 @@ def finished(): L.debug("Stop paging, yielded={}, result_count={}".format( num_yielded, result_count)) return True + elif args['page_number'] == 100: + L.debug("Reached maximum allowable page number. " + "Stop paging, yielded={}, result_count={}".format( + num_yielded, result_count)) + return True else: return False