apify 2.0.0b11__py3-none-any.whl → 2.0.0b13__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/__init__.py CHANGED
@@ -1,6 +1,7 @@
1
1
  from importlib import metadata
2
2
 
3
3
  from apify_shared.consts import WebhookEventType
4
+ from crawlee import Request
4
5
  from crawlee.events._types import Event
5
6
 
6
7
  from apify._actor import Actor
@@ -16,6 +17,7 @@ __all__ = [
16
17
  'Configuration',
17
18
  'ProxyConfiguration',
18
19
  'ProxyInfo',
20
+ 'Request',
19
21
  'Webhook',
20
22
  'WebhookEventType',
21
23
  '__version__',
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  from typing import TYPE_CHECKING
4
4
 
5
+ from more_itertools import chunked
5
6
  from typing_extensions import override
6
7
 
7
8
  from crawlee import Request
@@ -157,8 +158,11 @@ class RequestQueueClient(BaseRequestQueueClient):
157
158
  *,
158
159
  forefront: bool = False,
159
160
  ) -> BatchRequestsOperationResponse:
160
- return BatchRequestsOperationResponse.model_validate(
161
- await self._client.batch_add_requests(
161
+ processed = []
162
+ unprocessed = []
163
+
164
+ for chunk in chunked(requests, 25): # The API endpoint won't accept more than 25 requests at once
165
+ response = await self._client.batch_add_requests(
162
166
  requests=[
163
167
  r.model_dump(
164
168
  by_alias=True,
@@ -170,10 +174,18 @@ class RequestQueueClient(BaseRequestQueueClient):
170
174
  'data',
171
175
  },
172
176
  )
173
- for r in requests
177
+ for r in chunk
174
178
  ],
175
179
  forefront=forefront,
176
180
  )
181
+ processed.extend(response['processedRequests'])
182
+ unprocessed.extend(response['unprocessedRequests'])
183
+
184
+ return BatchRequestsOperationResponse.model_validate(
185
+ {
186
+ 'processedRequests': processed,
187
+ 'unprocessedRequests': unprocessed,
188
+ }
177
189
  )
178
190
 
179
191
  @override
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: apify
3
- Version: 2.0.0b11
3
+ Version: 2.0.0b13
4
4
  Summary: Apify SDK for Python
5
5
  License: Apache-2.0
6
6
  Keywords: apify,sdk,automation,chrome,crawlee,crawler,headless,scraper,scraping
@@ -1,4 +1,4 @@
1
- apify/__init__.py,sha256=6D62MrlyEsGWRLG5BQXPG5ODGXhBQVjrkJxogVxCT5Y,507
1
+ apify/__init__.py,sha256=ikoi2EpDYl6y-XSVtlU8UsdQdMEyOiIJCRRAaZFDOP8,550
2
2
  apify/_actor.py,sha256=0HqsIIdyMGjrUWHoTxuvHb95UMFzvJsMGKqgrqfZVoA,41188
3
3
  apify/_configuration.py,sha256=gf7YOun32Whc9DamhoWDLmcUeNwtWVmmBPrl4oq6s4I,8997
4
4
  apify/_consts.py,sha256=_Xq4hOfOA1iZ3n1P967YWdyncKivpbX6RTlp_qanUoE,330
@@ -13,7 +13,7 @@ apify/apify_storage_client/_dataset_client.py,sha256=j9seF2OKvbSMD9R9XF9fpa1vtr_
13
13
  apify/apify_storage_client/_dataset_collection_client.py,sha256=fkYvYGQCigHD2CDzpWk0swNAkfvAinAhMGpYqllle3E,1445
14
14
  apify/apify_storage_client/_key_value_store_client.py,sha256=uyeQgb75sGFsqIS4sq4hEZ3QP81COLfS3tmTqHc0tso,3340
15
15
  apify/apify_storage_client/_key_value_store_collection_client.py,sha256=vCtMTI-jx89Qp5WHILDNkCthwLuv0MAwm1J_5E4aypU,1519
16
- apify/apify_storage_client/_request_queue_client.py,sha256=jAiFkaJ38_myHFGTw-Rk21wmpbN0UCR2w2SFoimFGFc,5826
16
+ apify/apify_storage_client/_request_queue_client.py,sha256=P8ws8jEzi2PWpp-cvYfV7kwuKbgH813BpNQ_wMSVtTA,6278
17
17
  apify/apify_storage_client/_request_queue_collection_client.py,sha256=NnO73UJ9ZrjV8xoudo30wfaM-SojRkG0guhxDyB-K1g,1527
18
18
  apify/apify_storage_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  apify/log.py,sha256=Shns441HqiMC9FDdtmftgQmnJWQL3DAKHBRA0E7lbdQ,390
@@ -31,7 +31,7 @@ apify/scrapy/scheduler.py,sha256=AAIKY5i1QxkC1mtmix6n3M2eQaOw-d1T56Noue9xToc,601
31
31
  apify/scrapy/utils.py,sha256=tz_Y8CTqe6KbyMMhLF3m7qqR46jtNH5U7Ty7e19roPU,2814
32
32
  apify/storages/__init__.py,sha256=-9tEYJVabVs_eRVhUehxN58GH0UG8OfuGjGwuDieP2M,122
33
33
  apify/storages/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34
- apify-2.0.0b11.dist-info/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
35
- apify-2.0.0b11.dist-info/METADATA,sha256=52hCWtVU74KJjfPiQZhlRm3DbImTQNyRHsOmzx8Bfck,5232
36
- apify-2.0.0b11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
- apify-2.0.0b11.dist-info/RECORD,,
34
+ apify-2.0.0b13.dist-info/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
35
+ apify-2.0.0b13.dist-info/METADATA,sha256=HUfW-JsSUjdaBaatC9LPNpoQlelEHbNsMRTuRAT_eFA,5232
36
+ apify-2.0.0b13.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
37
+ apify-2.0.0b13.dist-info/RECORD,,