@@ -258,16 +258,8 @@ async def _list_head(self) -> None:
258258
259259 # Update the cached data
260260 for request_data in response .get ('items' , []):
261- # Due to https://github.com/apify/apify-core/blob/v0.1377.0/src/api/src/lib/request_queues/request_queue.ts#L53,
262- # the list_head endpoint may return truncated fields for long requests (e.g., long URLs or unique keys).
263- # If truncation is detected, fetch the full request data by its ID from the API.
264- # This is a temporary workaround - the caching will be refactored to use request IDs instead of unique keys.
265- # See https://github.com/apify/apify-sdk-python/issues/630 for details.
266- if '[truncated]' in request_data ['uniqueKey' ] or '[truncated]' in request_data ['url' ]:
267- request_data = await self ._api_client .get_request (request_id = request_data ['id' ]) # noqa: PLW2901
268-
269261 request = Request .model_validate (request_data )
270- request_id = unique_key_to_request_id ( request_data ['id' ])
262+ request_id = request_data ['id' ]
271263
272264 if request_id in self ._requests_in_progress :
273265 # Ignore requests that are already in progress, we will not process them again.
@@ -405,8 +397,10 @@ async def _update_request(
405397 Returns:
406398 The updated request
407399 """
400+ request_dict = request .model_dump (by_alias = True )
401+ request_dict ['id' ] = unique_key_to_request_id (request .unique_key )
408402 response = await self ._api_client .update_request (
409- request = request . model_dump ( by_alias = True ) ,
403+ request = request_dict ,
410404 forefront = forefront ,
411405 )
412406
0 commit comments