Skip to main content

BaseKeyValueStoreClient

crawlee.base_storage_client.base_key_value_store_client.BaseKeyValueStoreClient

Abstract base class for key-value store resource clients.

These clients are specific to the type of resource they manage and operate under a designated storage client, like a memory storage client.

Index

Methods

delete

  • async delete(): None
  • Permanently delete the key-value store managed by this client.


    Returns None

delete_record

  • async delete_record(key): None
  • Delete the specified record from the key-value store.


    Parameters

    • key: str

    Returns None

get

  • async get(): KeyValueStoreMetadata | None
  • Get metadata about the key-value store being managed by this client.


    Returns KeyValueStoreMetadata | None

get_record

  • async get_record(key): KeyValueStoreRecord | None
  • Retrieve the given record from the key-value store.


    Parameters

    • key: str

    Returns KeyValueStoreRecord | None

get_record_as_bytes

  • async get_record_as_bytes(key): KeyValueStoreRecord[bytes] | None
  • Retrieve the given record from the key-value store, without parsing it.


    Parameters

    • key: str

    Returns KeyValueStoreRecord[bytes] | None

list_keys

  • async list_keys(*, limit, exclusive_start_key): KeyValueStoreListKeysPage
  • List the keys in the key-value store.


    Parameters

    • limit: int = 1000keyword-only
    • exclusive_start_key: str | None = Nonekeyword-only

    Returns KeyValueStoreListKeysPage

set_record

  • async set_record(key, value, content_type): None
  • Set a value to the given record in the key-value store.


    Parameters

    • key: str
    • value: Any
    • content_type: str | None = None

    Returns None

stream_record

  • async stream_record(key): AsyncContextManager[KeyValueStoreRecord[Response] | None]
  • Retrieve the given record from the key-value store, as a stream.


    Parameters

    • key: str

    Returns AsyncContextManager[KeyValueStoreRecord[Response] | None]

update

  • async update(*, name): KeyValueStoreMetadata
  • Update the key-value store metadata.


    Parameters

    • name: str | None = Nonekeyword-only

    Returns KeyValueStoreMetadata