Skip to content

Commit dfeb550

Browse files
committed
Fix
1 parent 7600325 commit dfeb550

File tree

5 files changed

+15
-17
lines changed

5 files changed

+15
-17
lines changed

src/apify_client/_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: openapi.json
3-
# timestamp: 2025-12-26T10:24:32+00:00
3+
# timestamp: 2025-12-26T10:41:32+00:00
44

55
from __future__ import annotations
66

src/apify_client/_resource_clients/request_queue.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ def batch_add_requests(
302302
max_parallel: int = 1,
303303
max_unprocessed_requests_retries: int | None = None,
304304
min_delay_between_unprocessed_requests_retries: timedelta | None = None,
305-
) -> BatchOperationResponse:
305+
) -> Data13:
306306
"""Add requests to the request queue in batches.
307307
308308
Requests are split into batches based on size and processed in parallel.
@@ -373,7 +373,7 @@ def batch_add_requests(
373373
processed_requests=processed_requests,
374374
unprocessed_requests=unprocessed_requests,
375375
)
376-
)
376+
).data
377377

378378
def batch_delete_requests(self, requests: list[dict]) -> Data13:
379379
"""Delete given requests from the queue.
@@ -751,7 +751,7 @@ async def batch_add_requests(
751751
max_parallel: int = 5,
752752
max_unprocessed_requests_retries: int | None = None,
753753
min_delay_between_unprocessed_requests_retries: timedelta | None = None,
754-
) -> BatchOperationResponse:
754+
) -> Data13:
755755
"""Add requests to the request queue in batches.
756756
757757
Requests are split into batches based on size and processed in parallel.
@@ -823,7 +823,7 @@ async def batch_add_requests(
823823
processed_requests=processed_requests,
824824
unprocessed_requests=unprocessed_requests,
825825
)
826-
)
826+
).data
827827

828828
async def batch_delete_requests(self, requests: list[dict]) -> Data13:
829829
"""Delete given requests from the queue.

tests/integration/test_request_queue.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,8 @@ def test_request_queue_batch_add_requests(apify_client: ApifyClient) -> None:
238238
requests_to_add = [{'url': f'https://example.com/batch-{i}', 'uniqueKey': f'batch-{i}'} for i in range(10)]
239239
batch_response = queue_client.batch_add_requests(requests_to_add)
240240
assert batch_response is not None
241-
assert batch_response.data is not None
242-
assert len(batch_response.data.processed_requests) == 10
243-
assert len(batch_response.data.unprocessed_requests) == 0
241+
assert len(batch_response.processed_requests) == 10
242+
assert len(batch_response.unprocessed_requests) == 0
244243

245244
# Wait briefly for eventual consistency
246245
time.sleep(1)

tests/integration/test_request_queue_async.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,8 @@ async def test_request_queue_batch_add_requests(apify_client_async: ApifyClientA
238238
requests_to_add = [{'url': f'https://example.com/batch-{i}', 'uniqueKey': f'batch-{i}'} for i in range(10)]
239239
batch_response = await queue_client.batch_add_requests(requests_to_add)
240240
assert batch_response is not None
241-
assert batch_response.data is not None
242-
assert len(batch_response.data.processed_requests) == 10
243-
assert len(batch_response.data.unprocessed_requests) == 0
241+
assert len(batch_response.processed_requests) == 10
242+
assert len(batch_response.unprocessed_requests) == 0
244243

245244
# Wait briefly for eventual consistency
246245
await asyncio.sleep(1)

tests/unit/test_client_request_queue.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ async def test_batch_processed_partially_async(httpserver: HTTPServer) -> None:
6161
rq_client = client.request_queue(request_queue_id='whatever')
6262

6363
batch_response = await rq_client.batch_add_requests(requests=requests)
64-
assert requests[0]['uniqueKey'] in {request.unique_key for request in batch_response.data.processed_requests}
65-
assert len(batch_response.data.unprocessed_requests) == 1
66-
assert batch_response.data.unprocessed_requests[0].unique_key == requests[1]['uniqueKey']
64+
assert requests[0]['uniqueKey'] in {request.unique_key for request in batch_response.processed_requests}
65+
assert len(batch_response.unprocessed_requests) == 1
66+
assert batch_response.unprocessed_requests[0].unique_key == requests[1]['uniqueKey']
6767

6868

6969
@pytest.mark.usefixtures('patch_basic_url')
@@ -96,6 +96,6 @@ async def test_batch_processed_partially_sync(httpserver: HTTPServer) -> None:
9696
rq_client = client.request_queue(request_queue_id='whatever')
9797

9898
batch_response = rq_client.batch_add_requests(requests=requests)
99-
assert requests[0]['uniqueKey'] in {request.unique_key for request in batch_response.data.processed_requests}
100-
assert len(batch_response.data.unprocessed_requests) == 1
101-
assert batch_response.data.unprocessed_requests[0].unique_key == requests[1]['uniqueKey']
99+
assert requests[0]['uniqueKey'] in {request.unique_key for request in batch_response.processed_requests}
100+
assert len(batch_response.unprocessed_requests) == 1
101+
assert batch_response.unprocessed_requests[0].unique_key == requests[1]['uniqueKey']

0 commit comments

Comments
 (0)