apify-client
Index
Main Clients
Resource Clients
- ActorClient
- ActorCollectionClient
- ActorEnvVarClient
- ActorEnvVarCollectionClient
- ActorJobBaseClient
- ActorVersionClient
- ActorVersionCollectionClient
- BaseClient
- BuildClient
- BuildCollectionClient
- DatasetClient
- DatasetCollectionClient
- KeyValueStoreClient
- KeyValueStoreCollectionClient
- LogClient
- RequestQueueClient
- RequestQueueCollectionClient
- ResourceClient
- ResourceCollectionClient
- RunClient
- RunCollectionClient
- ScheduleClient
- ScheduleCollectionClient
- StoreCollectionClient
- TaskClient
- TaskCollectionClient
- UserClient
- WebhookClient
- WebhookCollectionClient
- WebhookDispatchClient
- WebhookDispatchCollectionClient
Async Resource Clients
- ActorClientAsync
- ActorCollectionClientAsync
- ActorEnvVarClientAsync
- ActorEnvVarCollectionClientAsync
- ActorJobBaseClientAsync
- ActorVersionClientAsync
- ActorVersionCollectionClientAsync
- BaseClientAsync
- BuildClientAsync
- BuildCollectionClientAsync
- DatasetClientAsync
- DatasetCollectionClientAsync
- KeyValueStoreClientAsync
- KeyValueStoreCollectionClientAsync
- LogClientAsync
- RequestQueueClientAsync
- RequestQueueCollectionClientAsync
- ResourceClientAsync
- ResourceCollectionClientAsync
- RunClientAsync
- RunCollectionClientAsync
- ScheduleClientAsync
- ScheduleCollectionClientAsync
- StatusMessageWatcherAsync
- StoreCollectionClientAsync
- StreamedLogAsync
- TaskClientAsync
- TaskCollectionClientAsync
- UserClientAsync
- WebhookClientAsync
- WebhookCollectionClientAsync
- WebhookDispatchClientAsync
- WebhookDispatchCollectionClientAsync
Helper Classes
Errors
Methods
- create_hmac_signature
- create_redirect_logger
- create_storage_content_signature
- encode_base62
- encode_webhook_list_to_base64
- filter_out_none_values_recursively
- filter_out_none_values_recursively_internal
- get_actor_env_var_representation
- get_actor_representation
- get_task_representation
- get_webhook_representation
- is_content_type_json
- is_content_type_text
- is_content_type_xml
- is_file_or_bytes
- json_dumps
- maybe_extract_enum_member_value
- parse_date_fields
Properties
Constants
Errors
is_retryable_error
Parameters
exc: Exception
Returns bool
Methods
create_hmac_signature
Generate an HMAC signature and encodes it using Base62. Base62 encoding reduces the signature length.
HMAC signature is truncated to 30 characters to make it shorter.
Parameters
secret_key: str
message: str
Returns str
create_redirect_logger
Create a logger for redirecting logs from another Actor.
Parameters
name: str
Returns logging.Logger
create_storage_content_signature
Create a secure signature for a resource like a dataset or key-value store.
This signature is used to generate a signed URL for authenticated access, which can be expiring or permanent. The signature is created using HMAC with the provided secret key and includes the resource ID, expiration time, and version.
Note: expires_in_millis is optional. If not provided, the signature will not expire.
Parameters
resource_id: str
url_signing_secret_key: str
expires_in_millis: int | None = None
version: int = 0
Returns str
encode_base62
Encode the given number to base62.
Parameters
num: int
Returns str
encode_webhook_list_to_base64
Encode a list of dictionaries representing webhooks to their base64-encoded representation for the API.
Parameters
webhooks: list[dict]
Returns str
filter_out_none_values_recursively
Return copy of the dictionary, recursively omitting all keys for which values are None.
Parameters
dictionary: dict
Returns dict
filter_out_none_values_recursively_internal
Recursively filters out None values from a dictionary.
Unfortunately, it's necessary to have an internal function for the correct result typing, without having to create complicated overloads
Parameters
dictionary: dict
keyword-onlyremove_empty_dicts: bool | None = None
Returns dict | None
get_actor_env_var_representation
Return an environment variable representation of the Actor in a dictionary.
Parameters
keyword-onlyis_secret: bool | None = None
keyword-onlyname: str | None = None
keyword-onlyvalue: str | None = None
Returns dict
get_actor_representation
Get dictionary representation of the Actor.
Parameters
keyword-onlyname: str | None
keyword-onlytitle: str | None = None
keyword-onlydescription: str | None = None
keyword-onlyseo_title: str | None = None
keyword-onlyseo_description: str | None = None
keyword-onlyversions: list[dict] | None = None
keyword-onlyrestart_on_error: bool | None = None
keyword-onlyis_public: bool | None = None
keyword-onlyis_deprecated: bool | None = None
keyword-onlyis_anonymously_runnable: bool | None = None
keyword-onlycategories: list[str] | None = None
keyword-onlydefault_run_build: str | None = None
keyword-onlydefault_run_max_items: int | None = None
keyword-onlydefault_run_memory_mbytes: int | None = None
keyword-onlydefault_run_timeout_secs: int | None = None
keyword-onlydefault_run_force_permission_level: ActorPermissionLevel | None = None
keyword-onlyexample_run_input_body: Any = None
keyword-onlyexample_run_input_content_type: str | None = None
keyword-onlyactor_standby_is_enabled: bool | None = None
keyword-onlyactor_standby_desired_requests_per_actor_run: int | None = None
keyword-onlyactor_standby_max_requests_per_actor_run: int | None = None
keyword-onlyactor_standby_idle_timeout_secs: int | None = None
keyword-onlyactor_standby_build: str | None = None
keyword-onlyactor_standby_memory_mbytes: int | None = None
keyword-onlypricing_infos: list[dict] | None = None
keyword-onlyactor_permission_level: ActorPermissionLevel | None = None
keyword-onlytagged_builds: dict[str, None | dict[str, str]] | None = None
Returns dict
get_task_representation
Get the dictionary representation of a task.
Parameters
actor_id: str | None = None
name: str | None = None
task_input: dict | None = None
build: str | None = None
max_items: int | None = None
memory_mbytes: int | None = None
timeout_secs: int | None = None
title: str | None = None
actor_standby_desired_requests_per_actor_run: int | None = None
actor_standby_max_requests_per_actor_run: int | None = None
actor_standby_idle_timeout_secs: int | None = None
actor_standby_build: str | None = None
actor_standby_memory_mbytes: int | None = None
keyword-onlyrestart_on_error: bool | None = None
Returns dict
get_webhook_representation
Prepare webhook dictionary representation for clients.
Parameters
keyword-onlyevent_types: list[WebhookEventType] | None = None
keyword-onlyrequest_url: str | None = None
keyword-onlypayload_template: str | None = None
keyword-onlyheaders_template: str | None = None
keyword-onlyactor_id: str | None = None
keyword-onlyactor_task_id: str | None = None
keyword-onlyactor_run_id: str | None = None
keyword-onlyignore_ssl_errors: bool | None = None
keyword-onlydo_not_retry: bool | None = None
keyword-onlyidempotency_key: str | None = None
keyword-onlyis_ad_hoc: bool | None = None
Returns dict
is_content_type_json
Check if the given content type is JSON.
Parameters
content_type: str
Returns bool
is_content_type_text
Check if the given content type is text.
Parameters
content_type: str
Returns bool
is_content_type_xml
Check if the given content type is XML.
Parameters
content_type: str
Returns bool
is_file_or_bytes
Check if the input value is a file-like object or bytes.
The check for IOBase is not ideal, it would be better to use duck typing, but then the check would be super complex, judging from how the 'requests' library does it. This way should be good enough for the vast majority of use cases, if it causes issues, we can improve it later.
Parameters
value: Any
Returns bool
json_dumps
Dump JSON to a string with the correct settings and serializer.
Parameters
obj: Any
Returns str
maybe_extract_enum_member_value
Extract the value of an enumeration member if it is an Enum, otherwise return the original value.
Parameters
maybe_enum_member: Any
Returns Any
parse_date_fields
Recursively parse date fields in a list or dictionary up to the specified depth.
Parameters
data: list | dict
max_depth: int = PARSE_DATE_FIELDS_MAX_DEPTH
Returns list | dict
Properties
JSONSerializable
Type for representing json-serializable values. It's close enough to the real thing supported by json.parse. It was suggested in a discussion with (and approved by) Guido van Rossum, so I'd consider it correct enough.
Check if the given error is retryable.
All
`impit.HTTPError`subclasses are considered retryable because they represent transport-level failures (network issues, timeouts, protocol errors, body decoding errors) that are typically transient. HTTP status code errors are handled separately in`_make_request`based on the response status code, not here.