1
1
from typing import Optional
2
2
3
- from apify_shared .consts import ApifyEnvVars
3
+ from apify_shared .consts import ActorEnvVars , ApifyEnvVars
4
4
5
5
from ._utils import _fetch_and_parse_env_var
6
6
@@ -67,30 +67,30 @@ def __init__(
67
67
system_info_interval_millis (str, optional): How often should the actor emit the SYSTEM_INFO event when running locally.
68
68
"""
69
69
# TODO: Document all these members
70
- self .actor_build_id = _fetch_and_parse_env_var (ApifyEnvVars . ACTOR_BUILD_ID )
71
- self .actor_build_number = _fetch_and_parse_env_var (ApifyEnvVars . ACTOR_BUILD_NUMBER )
72
- self .actor_events_ws_url = _fetch_and_parse_env_var (ApifyEnvVars . ACTOR_EVENTS_WS_URL )
73
- self .actor_id = _fetch_and_parse_env_var (ApifyEnvVars . ACTOR_ID )
74
- self .actor_run_id = _fetch_and_parse_env_var (ApifyEnvVars . ACTOR_RUN_ID )
75
- self .actor_task_id = _fetch_and_parse_env_var (ApifyEnvVars . ACTOR_TASK_ID )
70
+ self .actor_build_id = _fetch_and_parse_env_var (ActorEnvVars . BUILD_ID )
71
+ self .actor_build_number = _fetch_and_parse_env_var (ActorEnvVars . BUILD_NUMBER )
72
+ self .actor_events_ws_url = _fetch_and_parse_env_var (ActorEnvVars . EVENTS_WEBSOCKET_URL )
73
+ self .actor_id = _fetch_and_parse_env_var (ActorEnvVars . ID )
74
+ self .actor_run_id = _fetch_and_parse_env_var (ActorEnvVars . RUN_ID )
75
+ self .actor_task_id = _fetch_and_parse_env_var (ActorEnvVars . TASK_ID )
76
76
self .api_base_url = api_base_url or _fetch_and_parse_env_var (ApifyEnvVars .API_BASE_URL , 'https://api.apify.com' )
77
77
self .api_public_base_url = api_public_base_url or _fetch_and_parse_env_var (ApifyEnvVars .API_PUBLIC_BASE_URL , 'https://api.apify.com' )
78
78
self .chrome_executable_path = _fetch_and_parse_env_var (ApifyEnvVars .CHROME_EXECUTABLE_PATH )
79
- self .container_port = container_port or _fetch_and_parse_env_var (ApifyEnvVars . CONTAINER_PORT , 4321 )
80
- self .container_url = container_url or _fetch_and_parse_env_var (ApifyEnvVars . CONTAINER_URL , 'http://localhost:4321' )
79
+ self .container_port = container_port or _fetch_and_parse_env_var (ActorEnvVars . WEB_SERVER_PORT , 4321 )
80
+ self .container_url = container_url or _fetch_and_parse_env_var (ActorEnvVars . WEB_SERVER_URL , 'http://localhost:4321' )
81
81
self .dedicated_cpus = _fetch_and_parse_env_var (ApifyEnvVars .DEDICATED_CPUS )
82
82
self .default_browser_path = _fetch_and_parse_env_var (ApifyEnvVars .DEFAULT_BROWSER_PATH )
83
- self .default_dataset_id = default_dataset_id or _fetch_and_parse_env_var (ApifyEnvVars .DEFAULT_DATASET_ID , 'default' )
84
- self .default_key_value_store_id = default_key_value_store_id or _fetch_and_parse_env_var (ApifyEnvVars .DEFAULT_KEY_VALUE_STORE_ID , 'default' )
85
- self .default_request_queue_id = default_request_queue_id or _fetch_and_parse_env_var (ApifyEnvVars .DEFAULT_REQUEST_QUEUE_ID , 'default' )
83
+ self .default_dataset_id = default_dataset_id or _fetch_and_parse_env_var (ActorEnvVars .DEFAULT_DATASET_ID , 'default' )
84
+ self .default_key_value_store_id = default_key_value_store_id or _fetch_and_parse_env_var (ActorEnvVars .DEFAULT_KEY_VALUE_STORE_ID , 'default' )
85
+ self .default_request_queue_id = default_request_queue_id or _fetch_and_parse_env_var (ActorEnvVars .DEFAULT_REQUEST_QUEUE_ID , 'default' )
86
86
self .disable_browser_sandbox = _fetch_and_parse_env_var (ApifyEnvVars .DISABLE_BROWSER_SANDBOX , False )
87
87
self .headless = _fetch_and_parse_env_var (ApifyEnvVars .HEADLESS , True )
88
- self .input_key = input_key or _fetch_and_parse_env_var (ApifyEnvVars .INPUT_KEY , 'INPUT' )
88
+ self .input_key = input_key or _fetch_and_parse_env_var (ActorEnvVars .INPUT_KEY , 'INPUT' )
89
89
self .input_secrets_private_key_file = _fetch_and_parse_env_var (ApifyEnvVars .INPUT_SECRETS_PRIVATE_KEY_FILE )
90
90
self .input_secrets_private_key_passphrase = _fetch_and_parse_env_var (ApifyEnvVars .INPUT_SECRETS_PRIVATE_KEY_PASSPHRASE )
91
91
self .is_at_home = _fetch_and_parse_env_var (ApifyEnvVars .IS_AT_HOME , False )
92
92
self .max_used_cpu_ratio = max_used_cpu_ratio or _fetch_and_parse_env_var (ApifyEnvVars .MAX_USED_CPU_RATIO , 0.95 )
93
- self .memory_mbytes = _fetch_and_parse_env_var (ApifyEnvVars .MEMORY_MBYTES )
93
+ self .memory_mbytes = _fetch_and_parse_env_var (ActorEnvVars .MEMORY_MBYTES )
94
94
self .meta_origin = _fetch_and_parse_env_var (ApifyEnvVars .META_ORIGIN )
95
95
self .metamorph_after_sleep_millis = metamorph_after_sleep_millis or _fetch_and_parse_env_var (ApifyEnvVars .METAMORPH_AFTER_SLEEP_MILLIS , 300000 ) # noqa: E501
96
96
self .persist_state_interval_millis = persist_state_interval_millis or _fetch_and_parse_env_var (ApifyEnvVars .PERSIST_STATE_INTERVAL_MILLIS , 60000 ) # noqa: E501
@@ -100,8 +100,8 @@ def __init__(
100
100
self .proxy_port = proxy_port or _fetch_and_parse_env_var (ApifyEnvVars .PROXY_PORT , 8000 )
101
101
self .proxy_status_url = proxy_status_url or _fetch_and_parse_env_var (ApifyEnvVars .PROXY_STATUS_URL , 'http://proxy.apify.com' )
102
102
self .purge_on_start = purge_on_start or _fetch_and_parse_env_var (ApifyEnvVars .PURGE_ON_START , False )
103
- self .started_at = _fetch_and_parse_env_var (ApifyEnvVars .STARTED_AT )
104
- self .timeout_at = _fetch_and_parse_env_var (ApifyEnvVars .TIMEOUT_AT )
103
+ self .started_at = _fetch_and_parse_env_var (ActorEnvVars .STARTED_AT )
104
+ self .timeout_at = _fetch_and_parse_env_var (ActorEnvVars .TIMEOUT_AT )
105
105
self .token = token or _fetch_and_parse_env_var (ApifyEnvVars .TOKEN )
106
106
self .user_id = _fetch_and_parse_env_var (ApifyEnvVars .USER_ID )
107
107
self .xvfb = _fetch_and_parse_env_var (ApifyEnvVars .XVFB , False )
0 commit comments