ApifyKeyValueStoreClient
Index
Methods
__init__
Initialize a new instance.
Preferably use the
ApifyKeyValueStoreClient.open
class method to create a new instance.Parameters
keyword-onlyapi_client: KeyValueStoreClientAsync
keyword-onlyapi_public_base_url: str
keyword-onlylock: asyncio.Lock
Returns None
delete_value
Parameters
key: str
Returns None
drop
Returns None
get_metadata
Returns ApifyKeyValueStoreMetadata
get_public_url
Get a URL for the given key that may be used to publicly access the value in the remote key-value store.
Parameters
key: str
The key for which the URL should be generated.
Returns str
get_value
Parameters
key: str
Returns KeyValueStoreRecord | None
iterate_keys
Parameters
optionalkeyword-onlyexclusive_start_key: str | None = None
optionalkeyword-onlylimit: int | None = None
Returns AsyncIterator[KeyValueStoreRecordMetadata]
open
Open an Apify key-value store client.
This method creates and initializes a new instance of the Apify key-value store client. It handles authentication, storage lookup/creation, and metadata retrieval.
Parameters
keyword-onlyid: str | None
The ID of the KVS to open. If provided, searches for existing KVS by ID. Mutually exclusive with name and alias.
keyword-onlyname: str | None
The name of the KVS to open (global scope, persists across runs). Mutually exclusive with id and alias.
keyword-onlyalias: str | None
The alias of the KVS to open (run scope, creates unnamed storage). Mutually exclusive with id and name.
keyword-onlyconfiguration: Configuration
The configuration object containing API credentials and settings. Must include a valid
token
andapi_base_url
. May also contain adefault_key_value_store_id
for fallback when neitherid
,name
, noralias
is provided.
Returns ApifyKeyValueStoreClient
purge
Returns None
record_exists
Parameters
key: str
Returns bool
set_value
Parameters
key: str
value: Any
optionalcontent_type: str | None = None
Returns None
An Apify platform implementation of the key-value store client.