@@ -158,6 +158,16 @@ def _raise_if_not_initialized(self) -> None:
158158 if not self ._is_initialized :
159159 raise RuntimeError ('The Actor was not initialized!' )
160160
161+ def _raise_if_cloud_requested_but_not_configured (self , * , force_cloud : bool ) -> None :
162+ if not force_cloud :
163+ return
164+
165+ if not self .is_at_home () and self .config .token is None :
166+ raise RuntimeError (
167+ 'In order to use the Apify cloud storage from your computer, '
168+ 'you need to provide an Apify token using the APIFY_TOKEN environment variable.'
169+ )
170+
161171 async def init (self ) -> None :
162172 """Initialize the Actor instance.
163173
@@ -335,6 +345,7 @@ async def open_dataset(
335345 An instance of the `Dataset` class for the given ID or name.
336346 """
337347 self ._raise_if_not_initialized ()
348+ self ._raise_if_cloud_requested_but_not_configured (force_cloud = force_cloud )
338349
339350 return await Dataset .open (
340351 id = id ,
@@ -367,6 +378,7 @@ async def open_key_value_store(
367378 An instance of the `KeyValueStore` class for the given ID or name.
368379 """
369380 self ._raise_if_not_initialized ()
381+ self ._raise_if_cloud_requested_but_not_configured (force_cloud = force_cloud )
370382
371383 return await KeyValueStore .open (
372384 id = id ,
@@ -401,6 +413,7 @@ async def open_request_queue(
401413 An instance of the `RequestQueue` class for the given ID or name.
402414 """
403415 self ._raise_if_not_initialized ()
416+ self ._raise_if_cloud_requested_but_not_configured (force_cloud = force_cloud )
404417
405418 return await RequestQueue .open (
406419 id = id ,
0 commit comments