Paginators
paginators
Fancy paginators with a large amount of useful methods.
Modules:
-
api–Base paginators made specifically for interaction with the api.
-
base–Base paginators.
Classes:
-
BufferedPaginator–Paginator with a support for buffers.
-
CursorPaginator–Paginator based on end_id cursors.
-
MergedPaginator–A paginator merging a collection of iterators.
-
PagedPaginator–Paginator for resources which only require a page number.
-
Paginator–Base paginator.
-
TokenPaginator–Paginator for resources which require a token.
BufferedPaginator
Paginator with a support for buffers.
Methods:
-
next_page–Get the next page of the paginator.
Attributes:
CursorPaginator
CursorPaginator(
getter: GetterCallback[UniqueT],
*,
limit: Optional[int] = None,
end_id: int = 0,
page_size: Optional[int] = 20,
)
Paginator based on end_id cursors.
Methods:
-
next_page–Get the next page of the paginator.
Attributes:
-
end_id(Optional[int]) –Current end id. If none then exhausted.
-
getter(GetterCallback[UniqueT]) –Underlying getter that yields the next page.
getter
instance-attribute
Underlying getter that yields the next page.
MergedPaginator
MergedPaginator(
iterables: Collection[AsyncIterable[T]],
*,
key: Optional[Callable[[T], Any]] = None,
limit: Optional[int] = None,
)
A paginator merging a collection of iterators.
Methods:
-
flatten–Flatten the paginator.
Attributes:
-
iterators(Sequence[AsyncIterator[T]]) –Entry iterators.
-
limit(Optional[int]) –Limit of items to be yielded
iterators
instance-attribute
iterators: Sequence[AsyncIterator[T]] = [
(__aiter__()) for iterable in iterables
]
Entry iterators.
Only used as pointers to a heap.
PagedPaginator
PagedPaginator(
getter: GetterCallback[T],
*,
limit: Optional[int] = None,
page_size: Optional[int] = None,
)
Paginator for resources which only require a page number.
Due to ratelimits the requests must be sequential.
Methods:
-
next_page–Get the next page of the paginator.
Attributes:
-
current_page(Optional[int]) –Current page counter..
-
getter(GetterCallback[T]) –Underlying getter that yields the next page.