Skip to content

Commit 983963a

Browse files
authored
chore: revert hotfix for batch add requests in client (#277)
reverting #261
1 parent 96d345d commit 983963a

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ keywords = [
4646
# https://github.com/apify/apify-sdk-python/pull/154.
4747
[tool.poetry.dependencies]
4848
python = "^3.9"
49-
apify-client = ">=1.7.1"
49+
apify-client = ">=1.8.1"
5050
apify-shared = ">=1.1.2"
5151
crawlee = ">=0.3.5"
5252
cryptography = ">=42.0.0"

src/apify/apify_storage_client/_request_queue_client.py

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from typing import TYPE_CHECKING
44

5-
from more_itertools import chunked
65
from typing_extensions import override
76

87
from crawlee import Request
@@ -158,11 +157,8 @@ async def batch_add_requests(
158157
*,
159158
forefront: bool = False,
160159
) -> BatchRequestsOperationResponse:
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(
160+
return BatchRequestsOperationResponse.model_validate(
161+
await self._client.batch_add_requests(
166162
requests=[
167163
r.model_dump(
168164
by_alias=True,
@@ -174,18 +170,10 @@ async def batch_add_requests(
174170
'data',
175171
},
176172
)
177-
for r in chunk
173+
for r in requests
178174
],
179175
forefront=forefront,
180176
)
181-
processed.extend(response['processedRequests'])
182-
unprocessed.extend(response['unprocessedRequests'])
183-
184-
return BatchRequestsOperationResponse.model_validate(
185-
{
186-
'processedRequests': processed,
187-
'unprocessedRequests': unprocessed,
188-
}
189177
)
190178

191179
@override

0 commit comments

Comments
 (0)