ApifyRequestQueueClient
Index
Methods
__init__
Initialize a new instance.
Preferably use the
ApifyRequestQueueClient.openclass method to create a new instance.Parameters
keyword-onlyapi_client: RequestQueueClientAsync
keyword-onlymetadata: RequestQueueMetadata
optionalkeyword-onlyaccess: Literal[single, shared] = 'single'
Returns None
add_batch_of_requests
Parameters
requests: Sequence[Request]
optionalkeyword-onlyforefront: bool = False
Returns AddRequestsResponse
drop
Returns None
fetch_next_request
Returns Request | None
get_metadata
Retrieve current metadata about the request queue.
This method fetches metadata from the Apify API and merges it with local estimations to provide the most up-to-date statistics. Local estimations are used to compensate for potential delays in API data propagation (typically a few seconds).
Returns ApifyRequestQueueMetadata
get_request
Parameters
unique_key: str
Returns Request | None
is_empty
Returns bool
mark_request_as_handled
Parameters
request: Request
Returns ProcessedRequest | None
open
Open an Apify request queue client.
This method creates and initializes a new request queue client instance, handling authentication, storage lookup or creation, metadata retrieval, and initialization of internal caching structures.
Parameters
keyword-onlyid: str | None
ID of an existing request queue to open. Mutually exclusive with
nameandalias.keyword-onlyname: str | None
Name of the request queue to open or create (persists across Actor runs). Mutually exclusive with
idandalias.keyword-onlyalias: str | None
Alias for the request queue (scoped to current Actor run, creates unnamed storage). Mutually exclusive with
idandname.keyword-onlyconfiguration: Configuration
Configuration object containing API credentials (
token,api_base_url) and optionally adefault_request_queue_idfor fallback when no identifier is provided.optionalkeyword-onlyaccess: Literal[single, shared] = 'single'
Access mode controlling the client's behavior:
single: Optimized for single-consumer scenarios (lower API usage, better performance).shared: Optimized for multi-consumer scenarios (more API calls, guaranteed consistency).
Returns ApifyRequestQueueClient
purge
Returns None
reclaim_request
Parameters
request: Request
optionalkeyword-onlyforefront: bool = False
Returns ProcessedRequest | None
Request queue client for the Apify platform.
This client provides access to request queues stored on the Apify platform, supporting both single-consumer and multi-consumer scenarios. It manages local caching, request fetching, and state synchronization with the platform's API.