Skip to content

Commit

Permalink
Handle pagination loop incase there is no data.
Browse files Browse the repository at this point in the history
  • Loading branch information
xacadil committed Apr 18, 2024
1 parent 57728d1 commit 9f1f963
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tap_restaurant365/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ def get_next_page_token(
self.previous_replications.append(replication_key_value)
start_date = (parser.parse(replication_key_value) + timedelta(seconds=1)) or parser.parse(self.config.get("start_date"))
today = datetime.today()
if (
previous_token
and "token" in previous_token
and start_date.replace(tzinfo=None)
== previous_token["token"].replace(tzinfo=None)
):
start_date = start_date + timedelta(days=self.days_delta)
next_token = start_date.replace(tzinfo=None)

if (today - next_token).days < self.days_delta:
Expand Down

0 comments on commit 9f1f963

Please sign in to comment.