1010 Task ,
1111 TaskInput ,
1212 TaskOptions ,
13+ TaskPublicConfig ,
1314 TaskResponse ,
1415 UpdateTaskRequest ,
1516)
@@ -83,6 +84,12 @@ def update(
8384 actor_standby_idle_timeout : timedelta | None = None ,
8485 actor_standby_build : str | None = None ,
8586 actor_standby_memory_mbytes : int | None = None ,
87+ is_public : bool | None = None ,
88+ public_config_seo_title : str | None = None ,
89+ public_config_seo_description : str | None = None ,
90+ public_config_input_schema_fields : list [str ] | None = None ,
91+ public_config_dataset_name : str | None = None ,
92+ public_config_dataset_view : str | None = None ,
8693 timeout : Timeout = 'short' ,
8794 ) -> Task :
8895 """Update the task with specified fields.
@@ -111,6 +118,16 @@ def update(
111118 it will be shut down.
112119 actor_standby_build: The build tag or number to run when the Actor is in Standby mode.
113120 actor_standby_memory_mbytes: The memory in megabytes to use when the Actor is in Standby mode.
121+ is_public: Set to `True` to publish the task on its public landing page, or `False` to unpublish it.
122+ Passing the value the task already has does nothing. Publishing requires the public display
123+ configuration to be filled in, and write access to the task's Actor.
124+ public_config_seo_title: SEO title of the public task page. Defaults to the task title when not set.
125+ public_config_seo_description: SEO description of the public task page. Defaults to the task description
126+ when not set.
127+ public_config_input_schema_fields: Names of the task input fields displayed on the public task page.
128+ public_config_dataset_name: Name of the dataset from the Actor's dataset schema whose results are
129+ displayed on the public task page.
130+ public_config_dataset_view: View key from the Actor's dataset schema shown on the public task page.
114131 timeout: Timeout for the API HTTP request.
115132
116133 Returns:
@@ -123,6 +140,14 @@ def update(
123140 name = name ,
124141 title = title ,
125142 input = task_input ,
143+ is_public = is_public ,
144+ public_config = TaskPublicConfig (
145+ seo_title = public_config_seo_title ,
146+ seo_description = public_config_seo_description ,
147+ input_schema_fields = public_config_input_schema_fields ,
148+ dataset_name = public_config_dataset_name ,
149+ dataset_view = public_config_dataset_view ,
150+ ),
126151 options = TaskOptions (
127152 build = build ,
128153 max_items = max_items ,
@@ -141,6 +166,40 @@ def update(
141166 result = self ._update (timeout = timeout , ** task_fields .model_dump (by_alias = True , exclude_none = True ))
142167 return TaskResponse .model_validate (result ).data
143168
169+ def publish (self , * , timeout : Timeout = 'short' ) -> Task :
170+ """Publish the task on its public landing page.
171+
172+ Convenience wrapper over `update` with `is_public` set to `True`. The task's Actor must be public and
173+ the task must have its public display configuration set up. Requires write access to the task and to its
174+ Actor. Publishing an already published task does nothing.
175+
176+ https://docs.apify.com/api/v2#/reference/actor-tasks/task-object/update-task
177+
178+ Args:
179+ timeout: Timeout for the API HTTP request.
180+
181+ Returns:
182+ The published task.
183+ """
184+ return self .update (is_public = True , timeout = timeout )
185+
186+ def unpublish (self , * , timeout : Timeout = 'short' ) -> Task :
187+ """Unpublish the task from its public landing page.
188+
189+ Convenience wrapper over `update` with `is_public` set to `False`. The public display configuration is
190+ preserved, so the task can be published again without re-entering it. Requires write access to the task
191+ and to its Actor. Unpublishing a task that is not published does nothing.
192+
193+ https://docs.apify.com/api/v2#/reference/actor-tasks/task-object/update-task
194+
195+ Args:
196+ timeout: Timeout for the API HTTP request.
197+
198+ Returns:
199+ The unpublished task.
200+ """
201+ return self .update (is_public = False , timeout = timeout )
202+
144203 def delete (self , * , timeout : Timeout = 'short' ) -> None :
145204 """Delete the task.
146205
@@ -406,6 +465,12 @@ async def update(
406465 actor_standby_idle_timeout : timedelta | None = None ,
407466 actor_standby_build : str | None = None ,
408467 actor_standby_memory_mbytes : int | None = None ,
468+ is_public : bool | None = None ,
469+ public_config_seo_title : str | None = None ,
470+ public_config_seo_description : str | None = None ,
471+ public_config_input_schema_fields : list [str ] | None = None ,
472+ public_config_dataset_name : str | None = None ,
473+ public_config_dataset_view : str | None = None ,
409474 timeout : Timeout = 'short' ,
410475 ) -> Task :
411476 """Update the task with specified fields.
@@ -434,6 +499,16 @@ async def update(
434499 it will be shut down.
435500 actor_standby_build: The build tag or number to run when the Actor is in Standby mode.
436501 actor_standby_memory_mbytes: The memory in megabytes to use when the Actor is in Standby mode.
502+ is_public: Set to `True` to publish the task on its public landing page, or `False` to unpublish it.
503+ Passing the value the task already has does nothing. Publishing requires the public display
504+ configuration to be filled in, and write access to the task's Actor.
505+ public_config_seo_title: SEO title of the public task page. Defaults to the task title when not set.
506+ public_config_seo_description: SEO description of the public task page. Defaults to the task description
507+ when not set.
508+ public_config_input_schema_fields: Names of the task input fields displayed on the public task page.
509+ public_config_dataset_name: Name of the dataset from the Actor's dataset schema whose results are
510+ displayed on the public task page.
511+ public_config_dataset_view: View key from the Actor's dataset schema shown on the public task page.
437512 timeout: Timeout for the API HTTP request.
438513
439514 Returns:
@@ -446,6 +521,14 @@ async def update(
446521 name = name ,
447522 title = title ,
448523 input = task_input ,
524+ is_public = is_public ,
525+ public_config = TaskPublicConfig (
526+ seo_title = public_config_seo_title ,
527+ seo_description = public_config_seo_description ,
528+ input_schema_fields = public_config_input_schema_fields ,
529+ dataset_name = public_config_dataset_name ,
530+ dataset_view = public_config_dataset_view ,
531+ ),
449532 options = TaskOptions (
450533 build = build ,
451534 max_items = max_items ,
@@ -464,6 +547,40 @@ async def update(
464547 result = await self ._update (timeout = timeout , ** task_fields .model_dump (by_alias = True , exclude_none = True ))
465548 return TaskResponse .model_validate (result ).data
466549
550+ async def publish (self , * , timeout : Timeout = 'short' ) -> Task :
551+ """Publish the task on its public landing page.
552+
553+ Convenience wrapper over `update` with `is_public` set to `True`. The task's Actor must be public and
554+ the task must have its public display configuration set up. Requires write access to the task and to its
555+ Actor. Publishing an already published task does nothing.
556+
557+ https://docs.apify.com/api/v2#/reference/actor-tasks/task-object/update-task
558+
559+ Args:
560+ timeout: Timeout for the API HTTP request.
561+
562+ Returns:
563+ The published task.
564+ """
565+ return await self .update (is_public = True , timeout = timeout )
566+
567+ async def unpublish (self , * , timeout : Timeout = 'short' ) -> Task :
568+ """Unpublish the task from its public landing page.
569+
570+ Convenience wrapper over `update` with `is_public` set to `False`. The public display configuration is
571+ preserved, so the task can be published again without re-entering it. Requires write access to the task
572+ and to its Actor. Unpublishing a task that is not published does nothing.
573+
574+ https://docs.apify.com/api/v2#/reference/actor-tasks/task-object/update-task
575+
576+ Args:
577+ timeout: Timeout for the API HTTP request.
578+
579+ Returns:
580+ The unpublished task.
581+ """
582+ return await self .update (is_public = False , timeout = timeout )
583+
467584 async def delete (self , * , timeout : Timeout = 'short' ) -> None :
468585 """Delete the task.
469586
0 commit comments