Skip to main content

ActorClient

apify_client.clients.ActorClient

Sub-client for manipulating a single Actor.

Index

Methods

build

  • build(*, version_number, beta_packages, tag, use_cache, wait_for_finish): dict

  • Parameters

    • version_number: strkeyword-only

      Actor version number to be built.

    • beta_packages: bool | None = Nonekeyword-only

      If True, then the Actor is built with beta versions of Apify NPM packages. By default, the build uses latest stable packages.

    • tag: str | None = Nonekeyword-only

      Tag to be applied to the build on success. By default, the tag is taken from the Actor version's buildTag property.

    • use_cache: bool | None = Nonekeyword-only

      If true, the Actor's Docker container will be rebuilt using layer cache (https://docs.docker.com/develop/develop-images/dockerfile_best-practices/`leverage`-build-cache). This is to enable quick rebuild during development. By default, the cache is not used.

    • wait_for_finish: int | None = Nonekeyword-only

      The maximum number of seconds the server waits for the build to finish before returning. By default it is 0, the maximum value is 60.

    Returns dict

    The build object

builds

  • builds(): BuildCollectionClient
  • Retrieve a client for the builds of this Actor.


    Returns BuildCollectionClient

call

  • call(*, run_input, content_type, build, max_items, memory_mbytes, timeout_secs, webhooks, wait_secs): dict | None
  • Start the Actor and wait for it to finish before returning the Run object.

    It waits indefinitely, unless the wait_secs argument is provided.

    https://docs.apify.com/api/v2#/reference/actors/run-collection/run-actor


    Parameters

    • run_input: Any = Nonekeyword-only

      The input to pass to the Actor run.

    • content_type: str | None = Nonekeyword-only

      The content type of the input.

    • build: str | None = Nonekeyword-only

      Specifies the Actor build to run. It can be either a build tag or build number. By default, the run uses the build specified in the default run configuration for the Actor (typically latest).

    • max_items: int | None = Nonekeyword-only

      Maximum number of results that will be returned by this run. If the Actor is charged per result, you will not be charged for more results than the given limit.

    • memory_mbytes: int | None = Nonekeyword-only

      Memory limit for the run, in megabytes. By default, the run uses a memory limit specified in the default run configuration for the Actor.

    • timeout_secs: int | None = Nonekeyword-only

      Optional timeout for the run, in seconds. By default, the run uses timeout specified in the default run configuration for the Actor.

    • webhooks: list[dict] | None = Nonekeyword-only

      Optional webhooks (https://docs.apify.com/webhooks) associated with the Actor run, which can be used to receive a notification, e.g. when the Actor finished or failed. If you already have a webhook set up for the Actor, you do not have to add it again here.

    • wait_secs: int | None = Nonekeyword-only

      The maximum number of seconds the server waits for the run to finish. If not provided, waits indefinitely.

    Returns dict | None

    The run object

delete

  • delete(): None

get

  • get(): dict | None

last_run

  • last_run(*, status, origin): RunClient
  • Retrieve the client for the last run of this Actor.

    Last run is retrieved based on the start time of the runs.


    Parameters

    • status: ActorJobStatus | None = Nonekeyword-only

      Consider only runs with this status.

    • origin: MetaOrigin | None = Nonekeyword-only

      Consider only runs started with this origin.

    Returns RunClient

    The resource client for the last run of this Actor.

runs

  • runs(): RunCollectionClient
  • Retrieve a client for the runs of this Actor.


    Returns RunCollectionClient

start

  • start(*, run_input, content_type, build, max_items, memory_mbytes, timeout_secs, wait_for_finish, webhooks): dict
  • Start the Actor and immediately return the Run object.

    https://docs.apify.com/api/v2#/reference/actors/run-collection/run-actor


    Parameters

    • run_input: Any = Nonekeyword-only

      The input to pass to the Actor run.

    • content_type: str | None = Nonekeyword-only

      The content type of the input.

    • build: str | None = Nonekeyword-only

      Specifies the Actor build to run. It can be either a build tag or build number. By default, the run uses the build specified in the default run configuration for the Actor (typically latest).

    • max_items: int | None = Nonekeyword-only

      Maximum number of results that will be returned by this run. If the Actor is charged per result, you will not be charged for more results than the given limit.

    • memory_mbytes: int | None = Nonekeyword-only

      Memory limit for the run, in megabytes. By default, the run uses a memory limit specified in the default run configuration for the Actor.

    • timeout_secs: int | None = Nonekeyword-only

      Optional timeout for the run, in seconds. By default, the run uses timeout specified in the default run configuration for the Actor.

    • wait_for_finish: int | None = Nonekeyword-only

      The maximum number of seconds the server waits for the run to finish. By default, it is 0, the maximum value is 60.

    • webhooks: list[dict] | None = Nonekeyword-only

      Optional ad-hoc webhooks (https://docs.apify.com/webhooks/ad-hoc-webhooks) associated with the Actor run which can be used to receive a notification, e.g. when the Actor finished or failed. If you already have a webhook set up for the Actor or task, you do not have to add it again here. Each webhook is represented by a dictionary containing these items: * `event_types`: list of `WebhookEventType` values which trigger the webhook * `request_url`: URL to which to send the webhook HTTP request * `payload_template` (optional): Optional template for the request payload

    Returns dict

    The run object

update

  • update(*, name, title, description, seo_title, seo_description, versions, restart_on_error, is_public, is_deprecated, is_anonymously_runnable, categories, default_run_build, default_run_max_items, default_run_memory_mbytes, default_run_timeout_secs, example_run_input_body, example_run_input_content_type, actor_standby_is_enabled, actor_standby_desired_requests_per_actor_run, actor_standby_max_requests_per_actor_run, actor_standby_idle_timeout_secs, actor_standby_build, actor_standby_memory_mbytes): dict

  • Parameters

    • name: str | None = Nonekeyword-only

      The name of the Actor

    • title: str | None = Nonekeyword-only

      The title of the Actor (human-readable)

    • description: str | None = Nonekeyword-only

      The description for the Actor

    • seo_title: str | None = Nonekeyword-only

      The title of the Actor optimized for search engines

    • seo_description: str | None = Nonekeyword-only

      The description of the Actor optimized for search engines

    • versions: list[dict] | None = Nonekeyword-only

      The list of Actor versions

    • restart_on_error: bool | None = Nonekeyword-only

      If true, the main Actor run process will be restarted whenever it exits with a non-zero status code.

    • is_public: bool | None = Nonekeyword-only

      Whether the Actor is public.

    • is_deprecated: bool | None = Nonekeyword-only

      Whether the Actor is deprecated.

    • is_anonymously_runnable: bool | None = Nonekeyword-only

      Whether the Actor is anonymously runnable.

    • categories: list[str] | None = Nonekeyword-only

      The categories to which the Actor belongs to.

    • default_run_build: str | None = Nonekeyword-only

      Tag or number of the build that you want to run by default.

    • default_run_max_items: int | None = Nonekeyword-only

      Default limit of the number of results that will be returned by runs of this Actor, if the Actor is charged per result.

    • default_run_memory_mbytes: int | None = Nonekeyword-only

      Default amount of memory allocated for the runs of this Actor, in megabytes.

    • default_run_timeout_secs: int | None = Nonekeyword-only

      Default timeout for the runs of this Actor in seconds.

    • example_run_input_body: Any = Nonekeyword-only

      Input to be prefilled as default input to new users of this Actor.

    • example_run_input_content_type: str | None = Nonekeyword-only

      The content type of the example run input.

    • actor_standby_is_enabled: bool | None = Nonekeyword-only

      Whether the Actor Standby is enabled.

    • actor_standby_desired_requests_per_actor_run: int | None = Nonekeyword-only

      The desired number of concurrent HTTP requests for a single Actor Standby run.

    • actor_standby_max_requests_per_actor_run: int | None = Nonekeyword-only

      The maximum number of concurrent HTTP requests for a single Actor Standby run.

    • actor_standby_idle_timeout_secs: int | None = Nonekeyword-only

      If the Actor run does not receive any requests for this time, it will be shut down.

    • actor_standby_build: str | None = Nonekeyword-only

      The build tag or number to run when the Actor is in Standby mode.

    • actor_standby_memory_mbytes: int | None = Nonekeyword-only

      The memory in megabytes to use when the Actor is in Standby mode.

    Returns dict

    The updated Actor

version

  • version(version_number): ActorVersionClient
  • Retrieve the client for the specified version of this Actor.


    Parameters

    • version_number: str

      The version number for which to retrieve the resource client.

    Returns ActorVersionClient

    The resource client for the specified Actor version.

versions

  • versions(): ActorVersionCollectionClient
  • Retrieve a client for the versions of this Actor.


    Returns ActorVersionCollectionClient

webhooks

  • webhooks(): WebhookCollectionClient
  • Retrieve a client for webhooks associated with this Actor.


    Returns WebhookCollectionClient