apify 2.7.1b19__py3-none-any.whl → 2.7.1b20__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of apify might be problematic. Click here for more details.

apify/_actor.py CHANGED
@@ -324,9 +324,6 @@ class _ActorType:
324
324
  self.log.info('Initializing Actor...')
325
325
  self.log.info('System info', extra=get_system_info())
326
326
 
327
- # TODO: Print outdated SDK version warning (we need a new env var for this)
328
- # https://github.com/apify/apify-sdk-python/issues/146
329
-
330
327
  await self.event_manager.__aenter__()
331
328
  self.log.debug('Event manager initialized')
332
329
 
apify/_configuration.py CHANGED
@@ -142,7 +142,7 @@ class Configuration(CrawleeConfiguration):
142
142
  ] = None
143
143
 
144
144
  default_dataset_id: Annotated[
145
- str,
145
+ str | None,
146
146
  Field(
147
147
  validation_alias=AliasChoices(
148
148
  'actor_default_dataset_id',
@@ -150,10 +150,10 @@ class Configuration(CrawleeConfiguration):
150
150
  ),
151
151
  description='Default dataset ID used by the Apify storage client when no ID or name is provided.',
152
152
  ),
153
- ] = 'default'
153
+ ] = None
154
154
 
155
155
  default_key_value_store_id: Annotated[
156
- str,
156
+ str | None,
157
157
  Field(
158
158
  validation_alias=AliasChoices(
159
159
  'actor_default_key_value_store_id',
@@ -161,10 +161,10 @@ class Configuration(CrawleeConfiguration):
161
161
  ),
162
162
  description='Default key-value store ID for the Apify storage client when no ID or name is provided.',
163
163
  ),
164
- ] = 'default'
164
+ ] = None
165
165
 
166
166
  default_request_queue_id: Annotated[
167
- str,
167
+ str | None,
168
168
  Field(
169
169
  validation_alias=AliasChoices(
170
170
  'actor_default_request_queue_id',
@@ -172,7 +172,7 @@ class Configuration(CrawleeConfiguration):
172
172
  ),
173
173
  description='Default request queue ID for the Apify storage client when no ID or name is provided.',
174
174
  ),
175
- ] = 'default'
175
+ ] = None
176
176
 
177
177
  disable_outdated_warning: Annotated[
178
178
  bool,
@@ -124,8 +124,10 @@ class ApifyDatasetClient(DatasetClient):
124
124
  )
125
125
  apify_datasets_client = apify_client_async.datasets()
126
126
 
127
- # Normalize 'default' alias to None
128
- alias = None if alias == 'default' else alias
127
+ # Normalize unnamed default storage in cases where not defined in `configuration.default_dataset_id` to unnamed
128
+ # storage aliased as `__default__`
129
+ if not any([alias, name, id, configuration.default_dataset_id]):
130
+ alias = '__default__'
129
131
 
130
132
  if alias:
131
133
  # Check if there is pre-existing alias mapping in the default KVS.
@@ -150,6 +152,11 @@ class ApifyDatasetClient(DatasetClient):
150
152
  # If none are provided, try to get the default storage ID from environment variables.
151
153
  elif id is None:
152
154
  id = configuration.default_dataset_id
155
+ if not id:
156
+ raise ValueError(
157
+ 'Dataset "id", "name", or "alias" must be specified, '
158
+ 'or a default dataset ID must be set in the configuration.'
159
+ )
153
160
 
154
161
  # Now create the client for the determined ID
155
162
  apify_dataset_client = apify_client_async.dataset(dataset_id=id)
@@ -115,8 +115,10 @@ class ApifyKeyValueStoreClient(KeyValueStoreClient):
115
115
  )
116
116
  apify_kvss_client = apify_client_async.key_value_stores()
117
117
 
118
- # Normalize 'default' alias to None
119
- alias = None if alias == 'default' else alias
118
+ # Normalize unnamed default storage in cases where not defined in `configuration.default_key_value_store_id` to
119
+ # unnamed storage aliased as `__default__`
120
+ if not any([alias, name, id, configuration.default_key_value_store_id]):
121
+ alias = '__default__'
120
122
 
121
123
  if alias:
122
124
  # Check if there is pre-existing alias mapping in the default KVS.
@@ -142,6 +144,11 @@ class ApifyKeyValueStoreClient(KeyValueStoreClient):
142
144
  # If none are provided, try to get the default storage ID from environment variables.
143
145
  elif id is None:
144
146
  id = configuration.default_key_value_store_id
147
+ if not id:
148
+ raise ValueError(
149
+ 'KeyValueStore "id", "name", or "alias" must be specified, '
150
+ 'or a default KeyValueStore ID must be set in the configuration.'
151
+ )
145
152
 
146
153
  # Now create the client for the determined ID
147
154
  apify_kvs_client = apify_client_async.key_value_store(key_value_store_id=id)
@@ -200,8 +200,10 @@ class ApifyRequestQueueClient(RequestQueueClient):
200
200
  )
201
201
  apify_rqs_client = apify_client_async.request_queues()
202
202
 
203
- # Normalize 'default' alias to None
204
- alias = None if alias == 'default' else alias
203
+ # Normalize unnamed default storage in cases where not defined in `configuration.default_request_queue_id` to
204
+ # unnamed storage aliased as `__default__`
205
+ if not any([alias, name, id, configuration.default_request_queue_id]):
206
+ alias = '__default__'
205
207
 
206
208
  if alias:
207
209
  # Check if there is pre-existing alias mapping in the default KVS.
@@ -226,6 +228,11 @@ class ApifyRequestQueueClient(RequestQueueClient):
226
228
  # If none are provided, try to get the default storage ID from environment variables.
227
229
  elif id is None:
228
230
  id = configuration.default_request_queue_id
231
+ if not id:
232
+ raise ValueError(
233
+ 'RequestQueue "id", "name", or "alias" must be specified, '
234
+ 'or a default default_request_queue_id ID must be set in the configuration.'
235
+ )
229
236
 
230
237
  # Use suitable client_key to make `hadMultipleClients` response of Apify API useful.
231
238
  # It should persist across migrated or resurrected Actor runs on the Apify platform.
@@ -76,7 +76,7 @@ class AliasResolver:
76
76
  Returns:
77
77
  Map of aliases and storage ids.
78
78
  """
79
- if not cls._alias_map:
79
+ if not cls._alias_map and Configuration.get_global_configuration().is_at_home:
80
80
  default_kvs_client = await _get_default_kvs_client()
81
81
 
82
82
  record = await default_kvs_client.get_record(cls._ALIAS_MAPPING_KEY)
@@ -156,7 +156,8 @@ async def _get_default_kvs_client() -> KeyValueStoreClientAsync:
156
156
  min_delay_between_retries_millis=500,
157
157
  timeout_secs=360,
158
158
  )
159
-
159
+ if not configuration.default_key_value_store_id:
160
+ raise ValueError("'Configuration.default_key_value_store_id' must be set.")
160
161
  return apify_client_async.key_value_store(key_value_store_id=configuration.default_key_value_store_id)
161
162
 
162
163
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apify
3
- Version: 2.7.1b19
3
+ Version: 2.7.1b20
4
4
  Summary: Apify SDK for Python
5
5
  Project-URL: Apify Homepage, https://apify.com
6
6
  Project-URL: Changelog, https://docs.apify.com/sdk/python/docs/changelog
@@ -1,7 +1,7 @@
1
1
  apify/__init__.py,sha256=HpgKg2FZWJuSPfDygzJ62psylhw4NN4tKFnoYUIhcd4,838
2
- apify/_actor.py,sha256=2Y_e7t2zlkZbuW7rQME7WdC4kjsoZBoCs4KCuowjbQE,56108
2
+ apify/_actor.py,sha256=FAN-ldqGaCztCehY7yNcEu3-jDr1ZuT0P0lyMcEDLNg,55960
3
3
  apify/_charging.py,sha256=KjZ2DnEMS0Tt8ibizmmt0RwBq8FOAsD1z-hKFgdazcY,13143
4
- apify/_configuration.py,sha256=DOKRjDGE2qU7LVPa5VZJzLShKGlkr7_207UOzfCAk_U,14676
4
+ apify/_configuration.py,sha256=gq_UfWTgcP1_0kEMLhXVg33SgSxXjShbuzoXyCFfK0w,14682
5
5
  apify/_consts.py,sha256=CjhyEJ4Mi0lcIrzfqz8dN7nPJWGjCeBrrXQy1PZ6zRI,440
6
6
  apify/_crypto.py,sha256=tqUs13QkemDtGzvU41pIA2HUEawpDlgzqbwKjm4I8kM,6852
7
7
  apify/_models.py,sha256=EzU-inWeJ7T5HNVYEwnYb79W-q4OAPhtrYctfRYzpTE,7848
@@ -35,19 +35,19 @@ apify/scrapy/pipelines/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
35
35
  apify/storage_clients/__init__.py,sha256=9WLAKs2GnnP0yyKR0mc3AfJ1IqXF48V3KPMp6KaB8kU,277
36
36
  apify/storage_clients/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
37
37
  apify/storage_clients/_apify/__init__.py,sha256=mtbVDsxqWL3kx30elnh0kAn2kZ4s3BBsWa15Y5e7RMU,347
38
- apify/storage_clients/_apify/_dataset_client.py,sha256=aKQsoIDLbuP6R8wo2DX6pzp-EHV5EWZlHWB8s8OLuG4,12096
39
- apify/storage_clients/_apify/_key_value_store_client.py,sha256=EWcWE6HiXBGklCAilj4My3T95py7Nu6Zt3e_XzpySUM,10099
38
+ apify/storage_clients/_apify/_dataset_client.py,sha256=Bb3UwOaFkyuEY7tuBf8K46R4ZP_b1EaAkDOXOqwSoW8,12498
39
+ apify/storage_clients/_apify/_key_value_store_client.py,sha256=42dARbLX2oeOW7uYYKkDyQbEriMuh55Mxh0SqvkOEGg,10529
40
40
  apify/storage_clients/_apify/_models.py,sha256=GEaN7Got1zIg42QPH36obHRWRDVNtzOkRuOWYRf9bFU,4572
41
- apify/storage_clients/_apify/_request_queue_client.py,sha256=fkjdA0Kaq8CquiTfWOKGXxXqbTB1nNWDQ9wL98g0nTg,32807
41
+ apify/storage_clients/_apify/_request_queue_client.py,sha256=xahuxmEOjms1fsWJk8vp5nBP5rG1WdYisfWjJidGoUQ,33243
42
42
  apify/storage_clients/_apify/_storage_client.py,sha256=7oqn8-7zG7_cruw6jzmRl2htX2rOt-KPTzCRVNCcyTA,3304
43
- apify/storage_clients/_apify/_utils.py,sha256=1g0oGqHmB-AeNfeMiB33om2bRZ_7wwhpijPXdWRPNsM,6609
43
+ apify/storage_clients/_apify/_utils.py,sha256=dRU-NPoQe7PI2FC_IRkisiggQUzo-w6q-u2LgcA5-Dc,6801
44
44
  apify/storage_clients/_apify/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
45
  apify/storage_clients/_file_system/__init__.py,sha256=rDbXatXV9wHKPhKTrXDzWnexhTm7sIJQWucMi-P-SD4,130
46
46
  apify/storage_clients/_file_system/_key_value_store_client.py,sha256=fnSJ1EIOPCGfcE6e5S3Tux9VbnMVLCJjugkaQoH_9yo,2267
47
47
  apify/storage_clients/_file_system/_storage_client.py,sha256=rcwpKYlrWzvlSA2xoxftg-EZAi_iGZ3vOCbu0C5lKDE,1396
48
48
  apify/storages/__init__.py,sha256=-9tEYJVabVs_eRVhUehxN58GH0UG8OfuGjGwuDieP2M,122
49
49
  apify/storages/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
- apify-2.7.1b19.dist-info/METADATA,sha256=XVHTFOiCHcLju1Im2srBp_IoV7ZZ6tk5snx8HrWpFoM,22580
51
- apify-2.7.1b19.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
52
- apify-2.7.1b19.dist-info/licenses/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
53
- apify-2.7.1b19.dist-info/RECORD,,
50
+ apify-2.7.1b20.dist-info/METADATA,sha256=IKZkZKJ2lWf67ql48sAmvHqIXMxuuiz4w3v6H9adoSU,22580
51
+ apify-2.7.1b20.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
52
+ apify-2.7.1b20.dist-info/licenses/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
53
+ apify-2.7.1b20.dist-info/RECORD,,