Skip to main content
Version: 0.2

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

Methods

__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

    • optionalkeyword-onlyapi_base_url: Optional[str] = None

      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.

    • optionalkeyword-onlyapi_public_base_url: Optional[str] = None

      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.

    • optionalkeyword-onlycontainer_port: Optional[int] = None

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

    • optionalkeyword-onlycontainer_url: Optional[str] = None

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

    • optionalkeyword-onlydefault_dataset_id: Optional[str] = None

      The ID of the default dataset for the actor.

    • optionalkeyword-onlydefault_key_value_store_id: Optional[str] = None

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

    • optionalkeyword-onlydefault_request_queue_id: Optional[str] = None

      The ID of the default request queue for the actor.

    • optionalkeyword-onlyinput_key: Optional[str] = None

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

    • optionalkeyword-onlymax_used_cpu_ratio: Optional[float] = None

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

    • optionalkeyword-onlymetamorph_after_sleep_millis: Optional[int] = None

      How long should the actor sleep after calling metamorph.

    • optionalkeyword-onlypersist_state_interval_millis: Optional[int] = None

      How often should the actor emit the PERSIST_STATE event.

    • optionalkeyword-onlypersist_storage: Optional[bool] = None

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

    • optionalkeyword-onlyproxy_hostname: Optional[str] = None

      The hostname of Apify Proxy.

    • optionalkeyword-onlyproxy_password: Optional[str] = None

      The password for Apify Proxy.

    • optionalkeyword-onlyproxy_port: Optional[int] = None

      The port of Apify Proxy.

    • optionalkeyword-onlyproxy_status_url: Optional[str] = None

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

    • optionalkeyword-onlypurge_on_start: Optional[bool] = None

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

    • optionalkeyword-onlytoken: Optional[str] = None

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

    • optionalkeyword-onlysystem_info_interval_millis: Optional[int] = None

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

    Returns None

get_global_configuration

  • get_global_configuration(): Configuration
  • Retrieve 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

Page Options