TaskClient
Hierarchy
- ResourceClient
- TaskClient
Index
Methods
__init__
Initialize the TaskClient.
Parameters
args: Any
kwargs: Any
Returns None
call
Start a task and wait for it to finish before returning the Run object.
It waits indefinitely, unless the wait_secs argument is provided.
https://docs.apify.com/api/v2#/reference/actor-tasks/run-collection/run-task
Parameters
optionalkeyword-onlytask_input: Optional[Dict[str, Any]] = None
Task input dictionary
optionalkeyword-onlybuild: Optional[str] = None
Specifies the actor build to run. It can be either a build tag or build number. By default, the run uses the build specified in the task settings (typically latest).
optionalkeyword-onlymemory_mbytes: Optional[int] = None
Memory limit for the run, in megabytes. By default, the run uses a memory limit specified in the task settings.
optionalkeyword-onlytimeout_secs: Optional[int] = None
Optional timeout for the run, in seconds. By default, the run uses timeout specified in the task settings.
optionalkeyword-onlywebhooks: Optional[List[Dict]] = None
Specifies optional webhooks associated with the actor run, which can be used to receive a notification e.g. when the actor finished or failed. Note: if you already have a webhook set up for the actor or task, you do not have to add it again here.
optionalkeyword-onlywait_secs: Optional[int] = None
The maximum number of seconds the server waits for the task run to finish. If not provided, waits indefinitely.
Returns Optional[Dict]
dict: The run object
delete
Returns None
get
Retrieve the task.
https://docs.apify.com/api/v2#/reference/actor-tasks/task-object/get-task
Returns Optional[Dict]
dict, optional: The retrieved task
get_input
Retrieve the default input for this task.
https://docs.apify.com/api/v2#/reference/actor-tasks/task-input-object/get-task-input
Returns Optional[Dict]
dict, optional: Retrieved task input
last_run
Retrieve the client for the last run of this task.
Last run is retrieved based on the start time of the runs.
Parameters
optionalkeyword-onlystatus: Optional[ActorJobStatus] = None
Consider only runs with this status.
Returns RunClient
RunClient: The resource client for the last run of this task.
runs
Retrieve a client for the runs of this task.
Returns RunCollectionClient
start
Start the task and immediately return the Run object.
https://docs.apify.com/api/v2#/reference/actor-tasks/run-collection/run-task
Parameters
optionalkeyword-onlytask_input: Optional[Dict[str, Any]] = None
Task input dictionary
optionalkeyword-onlybuild: Optional[str] = None
Specifies the actor build to run. It can be either a build tag or build number. By default, the run uses the build specified in the task settings (typically latest).
optionalkeyword-onlymemory_mbytes: Optional[int] = None
Memory limit for the run, in megabytes. By default, the run uses a memory limit specified in the task settings.
optionalkeyword-onlytimeout_secs: Optional[int] = None
Optional timeout for the run, in seconds. By default, the run uses timeout specified in the task settings.
optionalkeyword-onlywait_for_finish: Optional[int] = None
The maximum number of seconds the server waits for the run to finish. By default, it is 0, the maximum value is 300.
optionalkeyword-onlywebhooks: Optional[List[Dict]] = None
Optional ad-hoc webhooks (https://docs.apify.com/webhooks/ad-hoc-webhooks) associated with the actor run which can be used to receive a notification, e.g. when the actor finished or failed. If you already have a webhook set up for the actor or task, you do not have to add it again here. Each webhook is represented by a dictionary containing these items:
`event_types`: list of`WebhookEventType`values which trigger the webhook`request_url`: URL to which to send the webhook HTTP request`payload_template`(optional): Optional template for the request payload
Returns Dict
dict: The run object
update
Update the task with specified fields.
https://docs.apify.com/api/v2#/reference/actor-tasks/task-object/update-task
Parameters
optionalkeyword-onlyname: Optional[str] = None
Name of the task
optionalkeyword-onlytask_input: Optional[Dict] = None
Task input dictionary
optionalkeyword-onlybuild: Optional[str] = None
Actor build to run. It can be either a build tag or build number. By default, the run uses the build specified in the task settings (typically latest).
optionalkeyword-onlymemory_mbytes: Optional[int] = None
Memory limit for the run, in megabytes. By default, the run uses a memory limit specified in the task settings.
optionalkeyword-onlytimeout_secs: Optional[int] = None
Optional timeout for the run, in seconds. By default, the run uses timeout specified in the task settings.
Returns Dict
dict: The updated task
update_input
Update the default input for this task.
https://docs.apify.com/api/v2#/reference/actor-tasks/task-input-object/update-task-input
Parameters
keyword-onlytask_input: Dict
Returns Dict
dict, Retrieved task input
webhooks
Retrieve a client for webhooks associated with this task.
Returns WebhookCollectionClient
Sub-client for manipulating a single task.