PaginationConfig · Python
Choose how a crawler discovers the next page.
In this guide
Purpose and lifecycle
Use the named factories rather than calling the constructor. Attach the returned configuration with Crawl.withPagination/with_pagination.
Set crawl limits even when pagination has its own maximum. A URL pattern is not evidence that every generated page exists.
Definition and availability
Source snapshot: 1.0.0-alpha.3. Package export. Declared in source; this is not a runtime test result.
Signatures and source locations are generated from the SDK wrappers. Clean snapshots link to the recorded commit. Modified snapshots link to main, which may differ; file hashes identify the local inputs.
class PaginationConfigUsage example
Use a matching source build. Where a snippet uses page, obtain it with the Page example first. Example URLs illustrate API shape; they are not promised datasets.
from crawlingo import Crawl, PaginationConfig
crawl = Crawl("https://example.com/catalog?page=1").with_pagination(
PaginationConfig.page_number("https://example.com/catalog?page={page}", 1, 5)
).limit(5)Members
| Member | Kind | Return / value type | Source status |
|---|---|---|---|
| __init__ | method | Not annotated; see behavior notes | Present in source |
| next_link | static method | 'PaginationConfig' | Present in source |
| page_number | static method | 'PaginationConfig' | Present in source |
| url_pattern | static method | 'PaginationConfig' | Present in source |
__init__()
Wrap an existing native pagination configuration. Calling without it raises ValueError; use next_link, page_number or url_pattern.
Returns / value: Not annotated; see behavior notes.
def __init__(self, _core_config=None)| Parameter | Type | Required / default | Meaning |
|---|---|---|---|
| _core_config | Not annotated | Default: None | Native pagination handle; use the public pagination factories. |
next_link()
Use the href of the next-link selector.
Returns / value: 'PaginationConfig'.
def next_link(cls, selector: str) -> 'PaginationConfig'| Parameter | Type | Required / default | Meaning |
|---|---|---|---|
| selector | str | Required | Selector evaluated against the fetched DOM. |
page_number()
Construct numbered URLs from a template containing {page}, starting at startPage/start_page and bounded by maxPages/max_pages.
Returns / value: 'PaginationConfig'.
def page_number(cls, url_template: str, start_page: int, max_pages: int) -> 'PaginationConfig'| Parameter | Type | Required / default | Meaning |
|---|---|---|---|
| url_template | str | Required | URL template containing the literal {page} placeholder. |
| start_page | int | Required | First page number used by numbered pagination. |
| max_pages | int | Required | Numbered-pagination bound passed to the native configuration. |
url_pattern()
Increment the page number captured by a regular expression in the current URL; stop at the configured maximum.
Returns / value: 'PaginationConfig'.
def url_pattern(cls, page_regex: str, max_page: int) -> 'PaginationConfig'| Parameter | Type | Required / default | Meaning |
|---|---|---|---|
| page_regex | str | Required | Regular expression capturing the current page number in a URL. |
| max_page | int | Required | Upper page-number bound for pattern pagination. |
Errors and operational limits
Invalid patterns or templates can fail when evaluated by the crawler. Validate a small URL sequence before a larger crawl.
Source availability, package publication and runtime validation are separate facts. These pages describe the source snapshot, not a claim that all platforms or every API path have passed production acceptance.