3030 from decimal import Decimal
3131 from logging import Logger
3232
33- from apify_shared .consts import ActorJobStatus , MetaOrigin
33+ from apify_shared .consts import ActorJobStatus , ActorPermissionLevel , MetaOrigin
3434
3535
3636def get_actor_representation (
@@ -50,6 +50,7 @@ def get_actor_representation(
5050 default_run_max_items : int | None = None ,
5151 default_run_memory_mbytes : int | None = None ,
5252 default_run_timeout_secs : int | None = None ,
53+ default_run_force_permission_level : ActorPermissionLevel | None = None ,
5354 example_run_input_body : Any = None ,
5455 example_run_input_content_type : str | None = None ,
5556 actor_standby_is_enabled : bool | None = None ,
@@ -78,6 +79,7 @@ def get_actor_representation(
7879 'maxItems' : default_run_max_items ,
7980 'memoryMbytes' : default_run_memory_mbytes ,
8081 'timeoutSecs' : default_run_timeout_secs ,
82+ 'forcePermissionLevel' : default_run_force_permission_level ,
8183 },
8284 'exampleRunInput' : {
8385 'body' : example_run_input_body ,
@@ -224,6 +226,7 @@ def start(
224226 max_total_charge_usd : Decimal | None = None ,
225227 memory_mbytes : int | None = None ,
226228 timeout_secs : int | None = None ,
229+ force_permission_level : ActorPermissionLevel | None = None ,
227230 wait_for_finish : int | None = None ,
228231 webhooks : list [dict ] | None = None ,
229232 ) -> dict :
@@ -243,6 +246,8 @@ def start(
243246 specified in the default run configuration for the Actor.
244247 timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
245248 in the default run configuration for the Actor.
249+ force_permission_level: Override the Actor's permissions for this run. If not set, the Actor will run
250+ with permissions configured in the Actor settings.
246251 wait_for_finish: The maximum number of seconds the server waits for the run to finish. By default,
247252 it is 0, the maximum value is 60.
248253 webhooks: Optional ad-hoc webhooks (https://docs.apify.com/webhooks/ad-hoc-webhooks) associated with
@@ -265,6 +270,7 @@ def start(
265270 memory = memory_mbytes ,
266271 timeout = timeout_secs ,
267272 waitForFinish = wait_for_finish ,
273+ forcePermissionLevel = force_permission_level .value if force_permission_level is not None else None ,
268274 webhooks = encode_webhook_list_to_base64 (webhooks ) if webhooks is not None else None ,
269275 )
270276
@@ -289,6 +295,7 @@ def call(
289295 memory_mbytes : int | None = None ,
290296 timeout_secs : int | None = None ,
291297 webhooks : list [dict ] | None = None ,
298+ force_permission_level : ActorPermissionLevel | None = None ,
292299 wait_secs : int | None = None ,
293300 logger : Logger | None | Literal ['default' ] = 'default' ,
294301 ) -> dict | None :
@@ -310,6 +317,8 @@ def call(
310317 specified in the default run configuration for the Actor.
311318 timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
312319 in the default run configuration for the Actor.
320+ force_permission_level: Override the Actor's permissions for this run. If not set, the Actor will run
321+ with permissions configured in the Actor settings.
313322 webhooks: Optional webhooks (https://docs.apify.com/webhooks) associated with the Actor run, which can
314323 be used to receive a notification, e.g. when the Actor finished or failed. If you already have
315324 a webhook set up for the Actor, you do not have to add it again here.
@@ -332,6 +341,7 @@ def call(
332341 memory_mbytes = memory_mbytes ,
333342 timeout_secs = timeout_secs ,
334343 webhooks = webhooks ,
344+ force_permission_level = force_permission_level ,
335345 )
336346 if not logger :
337347 return self .root_client .run (started_run ['id' ]).wait_for_finish (wait_secs = wait_secs )
@@ -628,6 +638,7 @@ async def start(
628638 max_total_charge_usd : Decimal | None = None ,
629639 memory_mbytes : int | None = None ,
630640 timeout_secs : int | None = None ,
641+ force_permission_level : ActorPermissionLevel | None = None ,
631642 wait_for_finish : int | None = None ,
632643 webhooks : list [dict ] | None = None ,
633644 ) -> dict :
@@ -647,6 +658,8 @@ async def start(
647658 specified in the default run configuration for the Actor.
648659 timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
649660 in the default run configuration for the Actor.
661+ force_permission_level: Override the Actor's permissions for this run. If not set, the Actor will run
662+ with permissions configured in the Actor settings.
650663 wait_for_finish: The maximum number of seconds the server waits for the run to finish. By default,
651664 it is 0, the maximum value is 60.
652665 webhooks: Optional ad-hoc webhooks (https://docs.apify.com/webhooks/ad-hoc-webhooks) associated with
@@ -669,6 +682,7 @@ async def start(
669682 memory = memory_mbytes ,
670683 timeout = timeout_secs ,
671684 waitForFinish = wait_for_finish ,
685+ forcePermissionLevel = force_permission_level ,
672686 webhooks = encode_webhook_list_to_base64 (webhooks ) if webhooks is not None else None ,
673687 )
674688
@@ -693,6 +707,7 @@ async def call(
693707 memory_mbytes : int | None = None ,
694708 timeout_secs : int | None = None ,
695709 webhooks : list [dict ] | None = None ,
710+ force_permission_level : ActorPermissionLevel | None = None ,
696711 wait_secs : int | None = None ,
697712 logger : Logger | None | Literal ['default' ] = 'default' ,
698713 ) -> dict | None :
@@ -714,6 +729,8 @@ async def call(
714729 specified in the default run configuration for the Actor.
715730 timeout_secs: Optional timeout for the run, in seconds. By default, the run uses timeout specified
716731 in the default run configuration for the Actor.
732+ force_permission_level: Override the Actor's permissions for this run. If not set, the Actor will run
733+ with permissions configured in the Actor settings.
717734 webhooks: Optional webhooks (https://docs.apify.com/webhooks) associated with the Actor run, which can
718735 be used to receive a notification, e.g. when the Actor finished or failed. If you already have
719736 a webhook set up for the Actor, you do not have to add it again here.
@@ -736,6 +753,7 @@ async def call(
736753 memory_mbytes = memory_mbytes ,
737754 timeout_secs = timeout_secs ,
738755 webhooks = webhooks ,
756+ force_permission_level = force_permission_level ,
739757 )
740758
741759 if not logger :
0 commit comments