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

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

  • 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

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): 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.

    Returns dict

    The updated actor

version

  • 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

webhooks