Skip to main content

Configuration

apify.Configuration

A class for specifying the configuration of an actor.

Can be used either globally via Configuration.get_global_configuration(), or it can be specific to each Actor instance on the actor.config property.

Index

Constructors

__init__

  • __init__(*, api_base_url, api_public_base_url, container_port, container_url, default_dataset_id, default_key_value_store_id, default_request_queue_id, input_key, max_used_cpu_ratio, metamorph_after_sleep_millis, persist_state_interval_millis, persist_storage, proxy_hostname, proxy_password, proxy_port, proxy_status_url, purge_on_start, token, system_info_interval_millis): None
  • Create a Configuration instance.

    All the parameters are loaded by default from environment variables when running on the Apify platform. You can override them here in the Configuration constructor, which might be useful for local testing of your actors.


    Parameters

    • api_base_url: str | None = Nonekeyword-only

      The URL of the Apify API. This is the URL actually used for connecting to the API, so it can contain an IP address when running in a container on the platform.

    • api_public_base_url: str | None = Nonekeyword-only

      The public URL of the Apify API. This will always contain the public URL of the API, even when running in a container on the platform. Useful for generating shareable URLs to key-value store records or datasets.

    • container_port: int | None = Nonekeyword-only

      The port on which the container can listen for HTTP requests.

    • container_url: str | None = Nonekeyword-only

      The URL on which the container can listen for HTTP requests.

    • default_dataset_id: str | None = Nonekeyword-only

      The ID of the default dataset for the actor.

    • default_key_value_store_id: str | None = Nonekeyword-only

      The ID of the default key-value store for the actor.

    • default_request_queue_id: str | None = Nonekeyword-only

      The ID of the default request queue for the actor.

    • input_key: str | None = Nonekeyword-only

      The key of the input record in the actor’s default key-value store

    • max_used_cpu_ratio: float | None = Nonekeyword-only

      The CPU usage above which the SYSTEM_INFO event will report the CPU is overloaded.

    • metamorph_after_sleep_millis: int | None = Nonekeyword-only

      How long should the actor sleep after calling metamorph.

    • persist_state_interval_millis: int | None = Nonekeyword-only

      How often should the actor emit the PERSIST_STATE event.

    • persist_storage: bool | None = Nonekeyword-only

      Whether the actor should persist its used storages to the filesystem when running locally.

    • proxy_hostname: str | None = Nonekeyword-only

      The hostname of Apify Proxy.

    • proxy_password: str | None = Nonekeyword-only

      The password for Apify Proxy.

    • proxy_port: int | None = Nonekeyword-only

      The port of Apify Proxy.

    • proxy_status_url: str | None = Nonekeyword-only

      The URL on which the Apify Proxy status page is available.

    • purge_on_start: bool | None = Nonekeyword-only

      Whether the actor should purge its default storages on startup, when running locally.

    • token: str | None = Nonekeyword-only

      The API token for the Apify API this actor should use.

    • system_info_interval_millis: int | None = Nonekeyword-only

      How often should the actor emit the SYSTEM_INFO event when running locally.

    Returns None

Methods

get_global_configuration

  • Retrive the global configuration.

    The global configuration applies when you call actor methods via their static versions, e.g. Actor.init(). Also accessible via Actor.config.


    Returns Configuration