Skip to content

Commit

Permalink
fix: Handle empty stargazers (#192)
Browse files Browse the repository at this point in the history
* Fix stargazers empty

* Have to convert to list first
  • Loading branch information
sicarul authored Apr 18, 2023
1 parent f5ce902 commit 9ddcb3a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tap_github/repository_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,11 @@ def get_next_page_token(
# If since parameter is present, try to exit early by looking at the last "starred_at".
# Noting that we are traversing in DESCENDING order by STARRED_AT.
if since:
results = extract_jsonpath(self.query_jsonpath, input=response.json())
*_, last = results
results = list(extract_jsonpath(self.query_jsonpath, input=response.json()))
# If no results, return None to exit early.
if len(results) == 0:
return None
last = results[-1]
if parse(last["starred_at"]) < parse(since):
return None
return super().get_next_page_token(response, previous_token)
Expand Down

0 comments on commit 9ddcb3a

Please sign in to comment.