AsyncPage Class — anthropic-sdk-python Architecture
Architecture documentation for the AsyncPage class in pagination.py from the anthropic-sdk-python codebase.
Entity Profile
Dependency Diagram
graph TD 782cf7e2_5ace_39d6_c5b0_de3c63fc0c18["AsyncPage"] b906442a_92b7_2131_d6a5_3712533b82f2["pagination.py"] 782cf7e2_5ace_39d6_c5b0_de3c63fc0c18 -->|defined in| b906442a_92b7_2131_d6a5_3712533b82f2 377c9bea_3468_58cc_c828_7a2e2325efbd["_get_page_items()"] 782cf7e2_5ace_39d6_c5b0_de3c63fc0c18 -->|method| 377c9bea_3468_58cc_c828_7a2e2325efbd f7ff5908_cd59_ffdc_0b19_7aa2aaf97a3f["has_next_page()"] 782cf7e2_5ace_39d6_c5b0_de3c63fc0c18 -->|method| f7ff5908_cd59_ffdc_0b19_7aa2aaf97a3f 3c9918f0_36d1_a2d3_6d99_94a22d063ef4["next_page_info()"] 782cf7e2_5ace_39d6_c5b0_de3c63fc0c18 -->|method| 3c9918f0_36d1_a2d3_6d99_94a22d063ef4
Relationship Graph
Source Code
src/anthropic/pagination.py lines 50–84
class AsyncPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
data: List[_T]
has_more: Optional[bool] = None
first_id: Optional[str] = None
last_id: 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]:
if self._options.params.get("before_id"):
first_id = self.first_id
if not first_id:
return None
return PageInfo(params={"before_id": first_id})
last_id = self.last_id
if not last_id:
return None
return PageInfo(params={"after_id": last_id})
Domain
Defined In
Source
Frequently Asked Questions
What is the AsyncPage class?
AsyncPage is a class in the anthropic-sdk-python codebase, defined in src/anthropic/pagination.py.
Where is AsyncPage defined?
AsyncPage is defined in src/anthropic/pagination.py at line 50.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free