Skip to content

fix: default_build() returns BuildClient #389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025
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
25 changes: 19 additions & 6 deletions src/apify_client/clients/resource_clients/actor.py
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@
ActorVersionCollectionClient,
ActorVersionCollectionClientAsync,
)
from apify_client.clients.resource_clients.build import BuildClient, BuildClientAsync
from apify_client.clients.resource_clients.build_collection import BuildCollectionClient, BuildCollectionClientAsync
from apify_client.clients.resource_clients.run import RunClient, RunClientAsync
from apify_client.clients.resource_clients.run_collection import RunCollectionClient, RunCollectionClientAsync
@@ -385,7 +386,7 @@ async def default_build(
self,
*,
wait_for_finish: int | None = None,
) -> dict:
) -> BuildClient:
"""Retrieve Actor's default build.
https://docs.apify.com/api/v2/act-build-default-get
@@ -395,15 +396,21 @@ async def default_build(
By default it is 0, the maximum value is 60.
Returns:
The build object.
The resource client for the default build of this Actor.
"""
request_params = self._params(
waitForFinish=wait_for_finish,
)

response = self.http_client.call(url=self._url('builds/default'), method='GET', params=request_params)
data = pluck_data(response.json())

return parse_date_fields(pluck_data(response.json()))
return BuildClient(
base_url=self.base_url,
http_client=self.http_client,
root_client=self.root_client,
resource_id=data['id'],
)

def last_run(
self,
@@ -746,7 +753,7 @@ async def default_build(
self,
*,
wait_for_finish: int | None = None,
) -> dict:
) -> BuildClientAsync:
"""Retrieve Actor's default build.
https://docs.apify.com/api/v2/act-build-default-get
@@ -756,7 +763,7 @@ async def default_build(
By default it is 0, the maximum value is 60.
Returns:
The build object.
The resource client for the default build of this Actor.
"""
request_params = self._params(
waitForFinish=wait_for_finish,
@@ -767,8 +774,14 @@ async def default_build(
method='GET',
params=request_params,
)
data = pluck_data(response.json())

return parse_date_fields(pluck_data(response.json()))
return BuildClientAsync(
base_url=self.base_url,
http_client=self.http_client,
root_client=self.root_client,
resource_id=data['id'],
)

def last_run(
self,