Docs/API reference

PaginationConfig · Python

Choose how a crawler discovers the next page.

Download .md
Developers2 min read9 sections
Source reference · Match your SDK version. Availability and known issues
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 PaginationConfig
python1 lines · copy-ready

Usage 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)
python4 lines · copy-ready

Members

MemberKindReturn / value typeSource status
__init__methodNot annotated; see behavior notesPresent in source
next_linkstatic method'PaginationConfig'Present in source
page_numberstatic method'PaginationConfig'Present in source
url_patternstatic 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)
python1 lines · copy-ready
ParameterTypeRequired / defaultMeaning
_core_configNot annotatedDefault: NoneNative pagination handle; use the public pagination factories.

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'
python1 lines · copy-ready
ParameterTypeRequired / defaultMeaning
url_templatestrRequiredURL template containing the literal {page} placeholder.
start_pageintRequiredFirst page number used by numbered pagination.
max_pagesintRequiredNumbered-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'
python1 lines · copy-ready
ParameterTypeRequired / defaultMeaning
page_regexstrRequiredRegular expression capturing the current page number in a URL.
max_pageintRequiredUpper 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.