singer_sdk.pagination.BaseAPIPaginator#

class singer_sdk.pagination.BaseAPIPaginator#

An API paginator object.

__init__(start_value: TPageToken) None#

Create a new paginator.

Parameters:

start_value – Initial value.

advance(response: Response) None#

Get a new page value and advance the current one.

Parameters:

response – API response object.

Raises:

RuntimeError – If a loop in pagination is detected. That is, when two consecutive pagination tokens are identical.

property count: int#

Count the number of pages traversed so far.

Returns:

Number of pages.

property current_value: TPageToken#

Get the current pagination value.

Returns:

Current page value.

property finished: bool#

Get a flag that indicates if the last page of data has been reached.

Returns:

True if there are no more pages.

abstract get_next(response: Response) TPageToken | None#

Get the next pagination token or index from the API response.

Parameters:

response – API response object.

Returns:

The next page token or index. Return None from this method to indicate

the end of pagination.

has_more(response: Response) bool#

Override this method to check if the endpoint has any pages left.

Parameters:

response – API response object.

Returns:

Boolean flag used to indicate if the endpoint has more pages.