Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/apify_client/clients/resource_clients/request_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,24 @@ def list_requests(

return parse_date_fields(pluck_data(response.json()))

def unlock_requests(self: RequestQueueClient) -> dict:
"""Unlock all requests in the queue, which were locked by the same clientKey or from the same Actor run.

https://docs.apify.com/api/v2#/reference/request-queues/request-collection/unlock-requests

Returns:
dict: Result of the unlock operation
"""
request_params = self._params(clientKey=self.client_key)

response = self.http_client.call(
url=self._url('requests/unlock'),
method='POST',
params=request_params,
)

return parse_date_fields(pluck_data(response.json()))


class RequestQueueClientAsync(ResourceClientAsync):
"""Async sub-client for manipulating a single request queue."""
Expand Down Expand Up @@ -813,3 +831,21 @@ async def list_requests(
)

return parse_date_fields(pluck_data(response.json()))

async def unlock_requests(self: RequestQueueClientAsync) -> dict:
"""Unlock all requests in the queue, which were locked by the same clientKey or from the same Actor run.

https://docs.apify.com/api/v2#/reference/request-queues/request-collection/unlock-requests

Returns:
dict: Result of the unlock operation
"""
request_params = self._params(clientKey=self.client_key)

response = await self.http_client.call(
url=self._url('requests/unlock'),
method='POST',
params=request_params,
)

return parse_date_fields(pluck_data(response.json()))