File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# generated by datamodel-codegen:
22# filename: openapi.json
3- # timestamp: 2026-01-09T14:50:55 +00:00
3+ # timestamp: 2026-01-13T19:37:26 +00:00
44
55from __future__ import annotations
66
@@ -1159,6 +1159,11 @@ class Task(BaseModel):
11591159 input : Input32 | None = None
11601160
11611161
1162+ class CreateTaskResponse (BaseModel ):
1163+ data : Task
1164+ standby_url : Annotated [str | None , Field (alias = 'standbyUrl' )] = None
1165+
1166+
11621167class Stats51 (BaseModel ):
11631168 pass
11641169
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ def get_task_representation(
3737 restart_on_error : bool | None = None ,
3838) -> dict :
3939 """Get the dictionary representation of a task."""
40- return {
40+ task_dict = {
4141 'actId' : actor_id ,
4242 'name' : name ,
4343 'options' : {
@@ -49,14 +49,27 @@ def get_task_representation(
4949 },
5050 'input' : task_input ,
5151 'title' : title ,
52- 'actorStandby' : {
52+ }
53+
54+ # Only include actorStandby if at least one field is provided
55+ if any (
56+ [
57+ actor_standby_desired_requests_per_actor_run is not None ,
58+ actor_standby_max_requests_per_actor_run is not None ,
59+ actor_standby_idle_timeout_secs is not None ,
60+ actor_standby_build is not None ,
61+ actor_standby_memory_mbytes is not None ,
62+ ]
63+ ):
64+ task_dict ['actorStandby' ] = {
5365 'desiredRequestsPerActorRun' : actor_standby_desired_requests_per_actor_run ,
5466 'maxRequestsPerActorRun' : actor_standby_max_requests_per_actor_run ,
5567 'idleTimeoutSecs' : actor_standby_idle_timeout_secs ,
5668 'build' : actor_standby_build ,
5769 'memoryMbytes' : actor_standby_memory_mbytes ,
58- },
59- }
70+ }
71+
72+ return task_dict
6073
6174
6275class TaskClient (ResourceClient ):
Original file line number Diff line number Diff line change 22
33from typing import TYPE_CHECKING , Any
44
5- from apify_client ._models import Task , TaskShort
5+ from apify_client ._models import CreateTaskResponse , Task , TaskShort
66from apify_client ._resource_clients .base import ResourceCollectionClient , ResourceCollectionClientAsync
77from apify_client ._resource_clients .task import get_task_representation
88from apify_client ._utils import filter_out_none_values_recursively
@@ -106,7 +106,7 @@ def create(
106106 )
107107
108108 result = self ._create (filter_out_none_values_recursively (task_representation ))
109- return Task .model_validate (result )
109+ return CreateTaskResponse .model_validate (result ). data
110110
111111
112112class TaskCollectionClientAsync (ResourceCollectionClientAsync ):
@@ -204,4 +204,4 @@ async def create(
204204 )
205205
206206 result = await self ._create (filter_out_none_values_recursively (task_representation ))
207- return Task .model_validate (result )
207+ return CreateTaskResponse .model_validate (result ). data
You can’t perform that action at this time.
0 commit comments