RequestProvider
crawlee.storages._request_provider.RequestProvider
Index
Methods
add_request
Add a single request to the provider and store it in underlying resource client.
Parameters
request: str | Request
forefront: bool = Falsekeyword-only
Returns ProcessedRequest
add_requests_batched
Add requests to the underlying resource client in batches.
Parameters
requests: Sequence[str | Request]
batch_size: int = 1000keyword-only
wait_time_between_batches: timedelta = timedelta(seconds=1)keyword-only
wait_for_all_requests_to_be_added: bool = Falsekeyword-only
wait_for_all_requests_to_be_added_timeout: timedelta | None = Nonekeyword-only
Returns None
drop
Removes the queue either from the Apify Cloud storage or from the local database.
Returns None
fetch_next_request
Returns Request | None
get_handled_count
Returns int
get_total_count
Returns int
is_empty
Returns bool
is_finished
Returns bool
mark_request_as_handled
Marks a request as handled after a successful processing (or after giving up retrying).
Parameters
request: Request
Returns ProcessedRequest | None
reclaim_request
Reclaims a failed request back to the queue, so that it can be returned for processing later again.
It is possible to modify the request data by supplying an updated request as a parameter.
Parameters
request: Request
forefront: bool = Falsekeyword-only
Returns ProcessedRequest | None
Properties
name
ID or name of the request queue.
Abstract base class defining the interface and common behaviour for request providers.
Request providers are used to manage and provide access to a storage of crawling requests.
Key responsibilities: - Fetching the next request to be processed. - Reclaiming requests that failed during processing, allowing retries. - Marking requests as successfully handled after processing. - Adding new requests to the provider, both individually and in batches. - Managing state information such as the total and handled request counts. - Deleting or dropping the provider from the underlying storage.
Subclasses of
RequestProvider
should provide specific implementations for each of the abstract methods.