Skip to content

Commit 8ce6902

Browse files
committed
addres RQ feedback from Pepa
1 parent e1afe2d commit 8ce6902

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

src/apify/storage_clients/_apify/_request_queue_client.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def __init__(
4040
self,
4141
*,
4242
api_client: RequestQueueClientAsync,
43-
api_public_base_url: str,
4443
lock: asyncio.Lock,
4544
) -> None:
4645
"""Initialize a new instance.
@@ -50,9 +49,6 @@ def __init__(
5049
self._api_client = api_client
5150
"""The Apify request queue client for API operations."""
5251

53-
self._api_public_base_url = api_public_base_url
54-
"""The public base URL for accessing the key-value store records."""
55-
5652
self._lock = lock
5753
"""A lock to ensure that only one operation is performed at a time."""
5854

@@ -166,7 +162,6 @@ async def open(
166162

167163
return cls(
168164
api_client=apify_rq_client,
169-
api_public_base_url=api_public_base_url,
170165
lock=asyncio.Lock(),
171166
)
172167

@@ -198,13 +193,14 @@ async def add_batch_of_requests(
198193
Returns:
199194
Response containing information about the added requests.
200195
"""
201-
# Prepare requests for API by converting to dictionaries
202-
requests_dict = [request.model_dump(by_alias=True) for request in requests]
203-
204-
# Remove 'id' fields from requests as the API doesn't accept them
205-
for request_dict in requests_dict:
206-
if 'id' in request_dict:
207-
del request_dict['id']
196+
# Prepare requests for API by converting to dictionaries.
197+
requests_dict = [
198+
request.model_dump(
199+
by_alias=True,
200+
exclude={'id'}, # Exclude ID fields from requests since the API doesn't accept them.
201+
)
202+
for request in requests
203+
]
208204

209205
# Send requests to API
210206
response = await self._api_client.batch_add_requests(requests=requests_dict, forefront=forefront)

0 commit comments

Comments
 (0)