Skip to main content

KeyValueStoreClientAsync

Async sub-client for manipulating a single key-value store.

Hierarchy

Index

Methods

__init__

  • __init__(*, base_url, root_client, http_client, resource_id, resource_path, params): None
  • Initialize a new instance.


    Parameters

    • keyword-onlybase_url: str

      Base URL of the API server.

    • keyword-onlyroot_client: ApifyClientAsync

      The ApifyClientAsync instance under which this resource client exists.

    • keyword-onlyhttp_client: HTTPClientAsync

      The HTTPClientAsync instance to be used in this client.

    • optionalkeyword-onlyresource_id: str | None = None

      ID of the manipulated resource, in case of a single-resource client.

    • keyword-onlyresource_path: str

      Path to the resource's endpoint on the API server.

    • optionalkeyword-onlyparams: dict | None = None

      Parameters to include in all requests from this client.

    Returns None

create_keys_public_url

  • async create_keys_public_url(*, limit, exclusive_start_key, collection, prefix, expires_in_secs): str
  • Generate a URL that can be used to access key-value store keys.

    If the client has permission to access the key-value store's URL signing key, the URL will include a signature to verify its authenticity.

    You can optionally control how long the signed URL should be valid using the expires_in_secs option. This value sets the expiration duration in seconds from the time the URL is generated. If not provided, the URL will not expire.

    Any other options (like limit or prefix) will be included as query parameters in the URL.


    Parameters

    • optionalkeyword-onlylimit: int | None = None
    • optionalkeyword-onlyexclusive_start_key: str | None = None
    • optionalkeyword-onlycollection: str | None = None
    • optionalkeyword-onlyprefix: str | None = None
    • optionalkeyword-onlyexpires_in_secs: int | None = None

    Returns str

    The public key-value store keys URL.

delete

  • async delete(): None

delete_record

  • async delete_record(key): None

get

  • async get(): dict | None

get_record

  • async get_record(key, signature): dict | None

get_record_as_bytes

  • async get_record_as_bytes(key, signature): dict | None

get_record_public_url

  • async get_record_public_url(key): str
  • Generate a URL that can be used to access key-value store record.

    If the client has permission to access the key-value store's URL signing key, the URL will include a signature to verify its authenticity.


    Parameters

    • key: str

      The key for which the URL should be generated.

    Returns str

    A public URL that can be used to access the value of the given key in the KVS.

list_keys

  • async list_keys(*, limit, exclusive_start_key, collection, prefix, signature): dict

  • Parameters

    • optionalkeyword-onlylimit: int | None = None

      Number of keys to be returned. Maximum value is 1000.

    • optionalkeyword-onlyexclusive_start_key: str | None = None

      All keys up to this one (including) are skipped from the result.

    • optionalkeyword-onlycollection: str | None = None

      The name of the collection in store schema to list keys from.

    • optionalkeyword-onlyprefix: str | None = None

      The prefix of the keys to be listed.

    • optionalkeyword-onlysignature: str | None = None

      Signature used to access the items.

    Returns dict

    The list of keys in the key-value store matching the given arguments.

record_exists

  • async record_exists(key): bool

set_record

  • async set_record(key, value, content_type): None

stream_record

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

    https://docs.apify.com/api/v2#/reference/key-value-stores/record/get-record


    Parameters

    • key: str

      Key of the record to retrieve.

    • optionalsignature: str | None = None

      Signature used to access the items.

    Returns AsyncIterator[dict | None]

    The requested record as a context-managed streaming Response, or None, if the record does not exist.

update

  • async update(*, name, general_access): dict

Properties

http_client

params

params: dict

resource_id

resource_id: str | None

root_client

url

url: str