Home / Class/ AsyncTokenPage Class — anthropic-sdk-python Architecture

AsyncTokenPage Class — anthropic-sdk-python Architecture

Architecture documentation for the AsyncTokenPage class in pagination.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  7735ad0a_46f6_3ec3_c504_75f4fa020b8c["AsyncTokenPage"]
  b906442a_92b7_2131_d6a5_3712533b82f2["pagination.py"]
  7735ad0a_46f6_3ec3_c504_75f4fa020b8c -->|defined in| b906442a_92b7_2131_d6a5_3712533b82f2
  f52f084b_7a49_7240_efe6_c9b3e2f434f4["_get_page_items()"]
  7735ad0a_46f6_3ec3_c504_75f4fa020b8c -->|method| f52f084b_7a49_7240_efe6_c9b3e2f434f4
  90eb4c52_b1ae_2cb3_712b_8934bb5178f4["has_next_page()"]
  7735ad0a_46f6_3ec3_c504_75f4fa020b8c -->|method| 90eb4c52_b1ae_2cb3_712b_8934bb5178f4
  9a7144b6_d2b8_773b_9491_c0a93144cb72["next_page_info()"]
  7735ad0a_46f6_3ec3_c504_75f4fa020b8c -->|method| 9a7144b6_d2b8_773b_9491_c0a93144cb72

Relationship Graph

Source Code

src/anthropic/pagination.py lines 116–142

class AsyncTokenPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
    data: List[_T]
    has_more: Optional[bool] = None
    next_page: Optional[str] = None

    @override
    def _get_page_items(self) -> List[_T]:
        data = self.data
        if not data:
            return []
        return data

    @override
    def has_next_page(self) -> bool:
        has_more = self.has_more
        if has_more is not None and has_more is False:
            return False

        return super().has_next_page()

    @override
    def next_page_info(self) -> Optional[PageInfo]:
        next_page = self.next_page
        if not next_page:
            return None

        return PageInfo(params={"page_token": next_page})

Frequently Asked Questions

What is the AsyncTokenPage class?
AsyncTokenPage is a class in the anthropic-sdk-python codebase, defined in src/anthropic/pagination.py.
Where is AsyncTokenPage defined?
AsyncTokenPage is defined in src/anthropic/pagination.py at line 116.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free