singer_sdk.pagination.BaseAPIPaginator

class singer_sdk.pagination.BaseAPIPaginator[source]

An API paginator object.

__init__(start_value)[source]

Create a new paginator.

Parameters:

start_value (TPageToken) – Initial value.

Return type:

None

advance(response)[source]

Get a new page value and advance the current one.

Parameters:

response (requests.Response) – API response object.

Raises:

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

Return type:

None

abstract get_next(response)[source]

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

Parameters:

response (requests.Response) – API response object.

Returns:

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

the end of pagination.

Return type:

TPageToken | None

has_more(response)[source]

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

Parameters:

response (requests.Response) – API response object.

Returns:

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

Return type:

bool

property count: int[source]

Count the number of pages traversed so far.

Returns:

Number of pages.

property current_value: TPageToken[source]

Get the current pagination value.

Returns:

Current page value.

property finished: bool[source]

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

Returns:

True if there are no more pages.