From 8eaa0bae62de29b854d0cc3ca74458a4101d038c Mon Sep 17 00:00:00 2001 From: Jin Gong Date: Fri, 28 Oct 2022 17:02:00 -0700 Subject: [PATCH 1/2] use next_page_token to fix zoom tap pagination --- tap_zoom/sync.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tap_zoom/sync.py b/tap_zoom/sync.py index 568e4db..4cf966d 100644 --- a/tap_zoom/sync.py +++ b/tap_zoom/sync.py @@ -41,11 +41,11 @@ def sync_endpoint(client, path = endpoint['path'].format(**key_bag) page_size = 1000 - page_number = 1 + next_page_token = '' while True: params = { 'page_size': page_size, - 'page_number': page_number + 'next_page_token': next_page_token } data = client.get(path, @@ -88,10 +88,10 @@ def sync_endpoint(client, child_endpoint, child_key_bag) - if endpoint.get('paginate', True) and page_number < data.get('page_count', 1): + if endpoint.get('paginate', True) and data['next_page_token']: # each endpoint has a different max page size, the server will send the one that is forced page_size = data['page_size'] - page_number += 1 + next_page_token = data['next_page_token'] else: break From 095b7eef89153f09eacfc72a168c9c42fd7fbd81 Mon Sep 17 00:00:00 2001 From: Jin Gong Date: Fri, 28 Oct 2022 17:06:57 -0700 Subject: [PATCH 2/2] avoid key error --- tap_zoom/sync.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tap_zoom/sync.py b/tap_zoom/sync.py index 4cf966d..565e19a 100644 --- a/tap_zoom/sync.py +++ b/tap_zoom/sync.py @@ -88,7 +88,7 @@ def sync_endpoint(client, child_endpoint, child_key_bag) - if endpoint.get('paginate', True) and data['next_page_token']: + if endpoint.get('paginate', True) and data.get('next_page_token', ''): # each endpoint has a different max page size, the server will send the one that is forced page_size = data['page_size'] next_page_token = data['next_page_token']