From bf3f9de7e7d98a3c5c7f9225bee3059a432c27ce Mon Sep 17 00:00:00 2001 From: Andy Huynh Date: Fri, 25 Sep 2020 15:51:01 -0700 Subject: [PATCH 1/2] Exit loop if start_after is None and add per_page to query string --- setup.py | 2 +- tap_intercom/sync.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 9fd150a..dbfcbfc 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ from setuptools import setup, find_packages setup(name='tap-intercom', - version='0.1.0', + version='0.1.1', description='Singer.io tap for extracting data from the Intercom API', author='jeff.huth@bytecode.io', classifiers=['Programming Language :: Python :: 3 :: Only'], diff --git a/tap_intercom/sync.py b/tap_intercom/sync.py index 4fa695d..e7c73a9 100644 --- a/tap_intercom/sync.py +++ b/tap_intercom/sync.py @@ -431,7 +431,9 @@ def sync_endpoint(client, #pylint: disable=too-many-branches elif cursor: pagination = data.get('pages', {}).get('next', {}) starting_after = pagination.get('starting_after', None) - next_url = '{}/{}?starting_after={}'.format(client.base_url, path, starting_after) + if starting_after is None: + break + next_url = '{}/{}?starting_after={}&per_page={}'.format(client.base_url, path, starting_after, limit) else: next_url = data.get('pages', {}).get('next', None) From 91ba1cb340fe609e12e6c2f94bdd1a7bacb44ba4 Mon Sep 17 00:00:00 2001 From: Andy Huynh Date: Fri, 25 Sep 2020 16:15:40 -0700 Subject: [PATCH 2/2] Update description in CHANGELOG --- CHANGELOG.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fd0e629..16dd4a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,19 +1,29 @@ # Changelog +## 0.1.1 + +- Break out of sync loop for cursor based pagination if `starting_after` is None +- Pass in `per_page` query param to `next_url` + ## 0.1.0 - * Add `sla_applied` and `statistics` objects. + +- Add `sla_applied` and `statistics` objects. ## 0.0.4 - * Adjust `client.py` to use API `v.2.0`. - * Remove `users` and `leads` streams. - * Add `contacts` stream. - * Add support for `cursor` style paging. + +- Adjust `client.py` to use API `v.2.0`. +- Remove `users` and `leads` streams. +- Add `contacts` stream. +- Add support for `cursor` style paging. ## 0.0.3 - * Adjust `client.py` to use API `v.1.4`; fix issues w/ `conversations` and `admins` missinng fields; fix `company_attributes` API version error; fix `write_bookmark` issue when scrolling. + +- Adjust `client.py` to use API `v.1.4`; fix issues w/ `conversations` and `admins` missinng fields; fix `company_attributes` API version error; fix `write_bookmark` issue when scrolling. ## 0.0.2 - * Fix rate limit issue in client.py, intermittently failing in Discover mode. + +- Fix rate limit issue in client.py, intermittently failing in Discover mode. ## 0.0.1 - * Initial commit + +- Initial commit