apify-client-python
Index
Async Resource Clients
Classes
- _BaseApifyClient
- _BaseBaseClient
- _BaseHTTPClient
- _ContextInjectingFilter
- _DebugLogFormatter
- ActorClient
- ActorClientAsync
- ActorCollectionClient
- ActorCollectionClientAsync
- ActorEnvVarClient
- ActorEnvVarClientAsync
- ActorEnvVarCollectionClient
- ActorEnvVarCollectionClientAsync
- ActorJobBaseClient
- ActorJobBaseClientAsync
- ActorVersionClient
- ActorVersionClientAsync
- ActorVersionCollectionClient
- ActorVersionCollectionClientAsync
- ApifyClient
- ApifyClientAsync
- BaseClient
- BaseClientAsync
- BatchAddRequestsResult
- BuildClient
- BuildClientAsync
- BuildCollectionClient
- BuildCollectionClientAsync
- DatasetClient
- DatasetClientAsync
- DatasetCollectionClient
- DatasetCollectionClientAsync
- HTTPClient
- HTTPClientAsync
- KeyValueStoreClient
- KeyValueStoreClientAsync
- KeyValueStoreCollectionClient
- KeyValueStoreCollectionClientAsync
- ListPage
- ListPage
- LogClient
- LogClientAsync
- LogContext
- RedirectLogFormatter
- RequestQueueClient
- RequestQueueClientAsync
- RequestQueueCollectionClient
- RequestQueueCollectionClientAsync
- ResourceClient
- ResourceClientAsync
- ResourceCollectionClient
- ResourceCollectionClientAsync
- RunClient
- RunClientAsync
- RunCollectionClient
- RunCollectionClientAsync
- ScheduleClient
- ScheduleClientAsync
- ScheduleCollectionClient
- ScheduleCollectionClientAsync
- StatusMessageWatcher
- StatusMessageWatcherAsync
- StatusMessageWatcherSync
- StoreCollectionClient
- StoreCollectionClientAsync
- StreamedLog
- StreamedLogAsync
- StreamedLogSync
- TaskClient
- TaskClientAsync
- TaskCollectionClient
- TaskCollectionClientAsync
- UserClient
- UserClientAsync
- WebhookClient
- WebhookClientAsync
- WebhookCollectionClient
- WebhookCollectionClientAsync
- WebhookDispatchClient
- WebhookDispatchClientAsync
- WebhookDispatchCollectionClient
- WebhookDispatchCollectionClientAsync
- WithLogDetailsClient
Data structures
Errors
Methods
- catch_not_found_or_throw
- create_redirect_logger
- encode_key_value_store_record_value
- 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
- is_retryable_error
- json_dumps
- maybe_extract_enum_member_value
- maybe_parse_response
- parse_date_fields
- pluck_data
- pluck_data_as_list
- retry_with_exp_backoff
- to_safe_id
Properties
- __version__
- API_VERSION
- DEFAULT_API_URL
- DEFAULT_BACKOFF_EXPONENTIAL_FACTOR
- DEFAULT_BACKOFF_RANDOM_FACTOR
- DEFAULT_TIMEOUT
- DEFAULT_WAIT_FOR_FINISH_SEC
- DEFAULT_WAIT_WHEN_JOB_NOT_EXIST_SEC
- JSONSerializable
- ListOrDict
- log_context
- logger
- logger
- logger
- logger_name
- PARSE_DATE_FIELDS_KEY_SUFFIX
- PARSE_DATE_FIELDS_MAX_DEPTH
- RECORD_NOT_FOUND_EXCEPTION_TYPES
- StopRetryingType
- T
- T
- T
Async Resource Clients
retry_with_exp_backoff_async
Methods
catch_not_found_or_throw
Parameters
exc: ApifyApiError
Returns None
create_redirect_logger
Parameters
name: str
The name of the logger. It can be used to inherit from other loggers. Example:
apify.xyz
will use logger namedxyz
and make it a children ofapify
logger.
Returns logging.Logger
encode_key_value_store_record_value
Parameters
value: Any
optionalcontent_type: str | None = None
Returns tuple[Any, 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
optionalkeyword-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
optionalkeyword-onlyis_secret: bool | None = None
optionalkeyword-onlyname: str | None = None
optionalkeyword-onlyvalue: str | None = None
Returns dict
get_actor_representation
Get dictionary representation of the Actor.
Parameters
keyword-onlyname: str | None
optionalkeyword-onlytitle: str | None = None
optionalkeyword-onlydescription: str | None = None
optionalkeyword-onlyseo_title: str | None = None
optionalkeyword-onlyseo_description: str | None = None
optionalkeyword-onlyversions: list[dict] | None = None
optionalkeyword-onlyrestart_on_error: bool | None = None
optionalkeyword-onlyis_public: bool | None = None
optionalkeyword-onlyis_deprecated: bool | None = None
optionalkeyword-onlyis_anonymously_runnable: bool | None = None
optionalkeyword-onlycategories: list[str] | None = None
optionalkeyword-onlydefault_run_build: str | None = None
optionalkeyword-onlydefault_run_max_items: int | None = None
optionalkeyword-onlydefault_run_memory_mbytes: int | None = None
optionalkeyword-onlydefault_run_timeout_secs: int | None = None
optionalkeyword-onlyexample_run_input_body: Any = None
optionalkeyword-onlyexample_run_input_content_type: str | None = None
optionalkeyword-onlyactor_standby_is_enabled: bool | None = None
optionalkeyword-onlyactor_standby_desired_requests_per_actor_run: int | None = None
optionalkeyword-onlyactor_standby_max_requests_per_actor_run: int | None = None
optionalkeyword-onlyactor_standby_idle_timeout_secs: int | None = None
optionalkeyword-onlyactor_standby_build: str | None = None
optionalkeyword-onlyactor_standby_memory_mbytes: int | None = None
optionalkeyword-onlypricing_infos: list[dict] | None = None
Returns dict
get_task_representation
Get the dictionary representation of a task.
Parameters
optionalactor_id: str | None = None
optionalname: str | None = None
optionaltask_input: dict | None = None
optionalbuild: str | None = None
optionalmax_items: int | None = None
optionalmemory_mbytes: int | None = None
optionaltimeout_secs: int | None = None
optionaltitle: str | None = None
optionalactor_standby_desired_requests_per_actor_run: int | None = None
optionalactor_standby_max_requests_per_actor_run: int | None = None
optionalactor_standby_idle_timeout_secs: int | None = None
optionalactor_standby_build: str | None = None
optionalactor_standby_memory_mbytes: int | None = None
Returns dict
get_webhook_representation
Prepare webhook dictionary representation for clients.
Parameters
optionalkeyword-onlyevent_types: list[WebhookEventType] | None = None
optionalkeyword-onlyrequest_url: str | None = None
optionalkeyword-onlypayload_template: str | None = None
optionalkeyword-onlyheaders_template: str | None = None
optionalkeyword-onlyactor_id: str | None = None
optionalkeyword-onlyactor_task_id: str | None = None
optionalkeyword-onlyactor_run_id: str | None = None
optionalkeyword-onlyignore_ssl_errors: bool | None = None
optionalkeyword-onlydo_not_retry: bool | None = None
optionalkeyword-onlyidempotency_key: str | None = None
optionalkeyword-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
is_retryable_error
Check if the given error is retryable.
Parameters
exc: Exception
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
maybe_parse_response
Parameters
response: Response
Returns Any
parse_date_fields
Recursively parse date fields in a list or dictionary up to the specified depth.
Parameters
data: ListOrDict
optionalmax_depth: int = PARSE_DATE_FIELDS_MAX_DEPTH
Returns ListOrDict
pluck_data
Parameters
parsed_response: Any
Returns dict
pluck_data_as_list
Parameters
parsed_response: Any
Returns list
retry_with_exp_backoff
to_safe_id
Parameters
id: str
Returns str
Properties
__version__
API_VERSION
DEFAULT_API_URL
DEFAULT_BACKOFF_EXPONENTIAL_FACTOR
DEFAULT_BACKOFF_RANDOM_FACTOR
DEFAULT_TIMEOUT
DEFAULT_WAIT_FOR_FINISH_SEC
DEFAULT_WAIT_WHEN_JOB_NOT_EXIST_SEC
JSONSerializable
Type for representing json-serializable values. It's close enough to the real thing supported by json.parse, and the best we can do until mypy supports recursive types. It was suggested in a discussion with (and approved by) Guido van Rossum, so I'd consider it correct enough.
Create a logger for redirecting logs from another Actor.