From aabb3a5ef287f1345d08abd6a5357a1e18ff7715 Mon Sep 17 00:00:00 2001 From: Daniil Poletaev <44584010+danpoletaev@users.noreply.github.com> Date: Wed, 9 Apr 2025 16:57:08 +0200 Subject: [PATCH 1/3] feat: add get default build method --- .../clients/resource_clients/actor.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/apify_client/clients/resource_clients/actor.py b/src/apify_client/clients/resource_clients/actor.py index 791788e9..ba17a525 100644 --- a/src/apify_client/clients/resource_clients/actor.py +++ b/src/apify_client/clients/resource_clients/actor.py @@ -381,6 +381,18 @@ def runs(self) -> RunCollectionClient: """Retrieve a client for the runs of this Actor.""" return RunCollectionClient(**self._sub_resource_init_options(resource_path='runs')) + async def default_build(self) -> dict: + """Retrieve Actor's default build. + + https://docs.apify.com/api/v2/act-build-default-get + + Returns: + The build object. + """ + response = self.http_client.call(url=self._url('builds/default'), method='GET') + + return parse_date_fields(pluck_data(response.json())) + def last_run( self, *, @@ -718,6 +730,18 @@ def runs(self) -> RunCollectionClientAsync: """Retrieve a client for the runs of this Actor.""" return RunCollectionClientAsync(**self._sub_resource_init_options(resource_path='runs')) + async def default_build(self) -> dict: + """Retrieve Actor's default build. + + https://docs.apify.com/api/v2/act-build-default-get + + Returns: + The build object. + """ + response = await self.http_client.call(url=self._url('builds/default'), method='GET') + + return parse_date_fields(pluck_data(response.json())) + def last_run( self, *, From 2464fb5f7d4cdb5c4d9bc9a0a515a98a90882507 Mon Sep 17 00:00:00 2001 From: Daniil Poletaev <44584010+danpoletaev@users.noreply.github.com> Date: Thu, 10 Apr 2025 13:41:33 +0200 Subject: [PATCH 2/3] feat: add params to default_build --- .../clients/resource_clients/actor.py | 28 ++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/apify_client/clients/resource_clients/actor.py b/src/apify_client/clients/resource_clients/actor.py index ba17a525..3e164f6e 100644 --- a/src/apify_client/clients/resource_clients/actor.py +++ b/src/apify_client/clients/resource_clients/actor.py @@ -381,7 +381,11 @@ def runs(self) -> RunCollectionClient: """Retrieve a client for the runs of this Actor.""" return RunCollectionClient(**self._sub_resource_init_options(resource_path='runs')) - async def default_build(self) -> dict: + async def default_build( + self, + *, + wait_for_finish: int | None = None, + ) -> dict: """Retrieve Actor's default build. https://docs.apify.com/api/v2/act-build-default-get @@ -389,7 +393,11 @@ async def default_build(self) -> dict: Returns: The build object. """ - response = self.http_client.call(url=self._url('builds/default'), method='GET') + request_params = self._params( + waitForFinish=wait_for_finish, + ) + + response = self.http_client.call(url=self._url('builds/default'), method='GET', params=request_params) return parse_date_fields(pluck_data(response.json())) @@ -730,7 +738,11 @@ def runs(self) -> RunCollectionClientAsync: """Retrieve a client for the runs of this Actor.""" return RunCollectionClientAsync(**self._sub_resource_init_options(resource_path='runs')) - async def default_build(self) -> dict: + async def default_build( + self, + *, + wait_for_finish: int | None = None, + ) -> dict: """Retrieve Actor's default build. https://docs.apify.com/api/v2/act-build-default-get @@ -738,7 +750,15 @@ async def default_build(self) -> dict: Returns: The build object. """ - response = await self.http_client.call(url=self._url('builds/default'), method='GET') + request_params = self._params( + waitForFinish=wait_for_finish, + ) + + response = await self.http_client.call( + url=self._url('builds/default'), + method='GET', + params=request_params, + ) return parse_date_fields(pluck_data(response.json())) From 0624c62e2c4c3e140f41805e4b32a023004c0178 Mon Sep 17 00:00:00 2001 From: Daniil Poletaev <44584010+danpoletaev@users.noreply.github.com> Date: Thu, 10 Apr 2025 13:57:25 +0200 Subject: [PATCH 3/3] chore: add args docs --- src/apify_client/clients/resource_clients/actor.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/apify_client/clients/resource_clients/actor.py b/src/apify_client/clients/resource_clients/actor.py index 3e164f6e..f162c5ff 100644 --- a/src/apify_client/clients/resource_clients/actor.py +++ b/src/apify_client/clients/resource_clients/actor.py @@ -390,6 +390,10 @@ async def default_build( https://docs.apify.com/api/v2/act-build-default-get + Args: + wait_for_finish: The maximum number of seconds the server waits for the build to finish before returning. + By default it is 0, the maximum value is 60. + Returns: The build object. """ @@ -747,6 +751,10 @@ async def default_build( https://docs.apify.com/api/v2/act-build-default-get + Args: + wait_for_finish: The maximum number of seconds the server waits for the build to finish before returning. + By default it is 0, the maximum value is 60. + Returns: The build object. """