aas_client3_2.pagination

Iterate over the paged results by following the cursors.

For example:

for a_submodel in pagination.iterate(
    lambda cursor: submodel_repository.get_all_submodels(server, cursor=cursor)
):
    ...

Each page is a separate request through the transport. Hence, a token refreshed or revoked between two pages takes effect on the next page.

class aas_client3_2.pagination.Page(*args, **kwargs)[source]

Represent a page of a paged result, such as GetSubmodelsResult.

All the paged results of aas_core3_2.types follow this protocol.

property paging_metadata: PagingMetadata

Give the cursor to the next page.

over_result_or_empty() → Iterator[T_co][source]

Iterate over the items of the page.

__init__(*args, **kwargs)
__orig_bases__ = (typing.Protocol[+T_co],)
__parameters__ = (+T_co,)
__protocol_attrs__ = {'over_result_or_empty', 'paging_metadata'}
classmethod __subclasshook__(other)

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

exception aas_client3_2.pagination.RepeatedCursor(cursor: str)[source]

Signal that the server gave a cursor which it has already given before.

__init__(cursor: str) → None[source]

Initialize with the given values.

cursor: str

The repeated cursor

aas_client3_2.pagination.iterate_pages(fetch: Callable[[str | None], PageT]) → Iterator[PageT][source]

Iterate over the pages by following the cursors.

Parameters:

fetch – fetch the page at the given cursor, or the first page if None

Yields:

the pages, in the order given by the server

Raises:

RepeatedCursor if the server repeats a cursor

aas_client3_2.pagination.iterate(fetch: Callable[[str | None], Page[T]]) → Iterator[T][source]

Iterate over the items of all the pages by following the cursors.

Parameters:

fetch – fetch the page at the given cursor, or the first page if None

Yields:

the items of all the pages, in the order given by the server

Raises:

RepeatedCursor if the server repeats a cursor