Skip to content
Draft
3 changes: 3 additions & 0 deletions tap_github/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,9 @@ def get_next_page_token(
Warning - we recommend to avoid using deep (nested) pagination.
"""

if hasattr(self, "do_not_paginate") and self.do_not_paginate:
return None

resp_json = response.json()

# Find if results contains "hasNextPage_X" flags and if any are True.
Expand Down
15 changes: 14 additions & 1 deletion tap_github/repository_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -2263,7 +2263,6 @@ def query(self) -> str:
cost
}
}

"""

schema = th.PropertiesList(
Expand Down Expand Up @@ -2296,6 +2295,20 @@ def query(self) -> str:
).to_dict()


class DependenciesStreamIncomplete(DependenciesStream):
"""Defines 'DependenciesStreamDirty' stream to limit pagination."""

do_not_paginate = True

@property
def query(self) -> str:
"""Return altered query to limit pagination."""
initial_query = super().query
no_pagination_query = initial_query.replace("first: 1", "first: 20")
no_pagination_query = no_pagination_query.replace("first: 50", "first: 100")
return no_pagination_query


class TrafficRestStream(GitHubRestStream):
"""Base class for Traffic Streams"""

Expand Down
2 changes: 2 additions & 0 deletions tap_github/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
CommunityProfileStream,
ContributorsStream,
DependenciesStream,
DependenciesStreamIncomplete,
DependentsStream,
EventsStream,
ExtraMetricsStream,
Expand Down Expand Up @@ -75,6 +76,7 @@ def __init__(self, valid_queries: Set[str], streams: List[Type[Stream]]):
CommunityProfileStream,
ContributorsStream,
DependenciesStream,
DependenciesStreamIncomplete,
DependentsStream,
EventsStream,
IssueCommentsStream,
Expand Down