Skip to content

Commit 1b14d4e

Browse files
authored
feat: add log() method to BuildClient (Python) (#179)
This exposes the new /actor-builds/:build_id/log endpoint. For more information, see the API reference at: https://docs.apify.com/api/v2/#/reference/actor-builds/build-log
1 parent f88a3b2 commit 1b14d4e

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## [1.6.3](../../releases/tag/v1.6.3) - Unreleased
44

5-
...
5+
- added `log()` method to `BuildClient`
66

77
## [1.6.2](../../releases/tag/v1.6.2) - 2023-01-08
88

src/apify_client/clients/resource_clients/build.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from apify_shared.utils import ignore_docs
66

77
from apify_client.clients.base import ActorJobBaseClient, ActorJobBaseClientAsync
8+
from apify_client.clients.resource_clients.log import LogClient, LogClientAsync
89

910

1011
class BuildClient(ActorJobBaseClient):
@@ -55,6 +56,18 @@ def wait_for_finish(self: BuildClient, *, wait_secs: int | None = None) -> dict
5556
"""
5657
return self._wait_for_finish(wait_secs=wait_secs)
5758

59+
def log(self: BuildClient) -> LogClient:
60+
"""Get the client for the log of the actor build.
61+
62+
https://docs.apify.com/api/v2/#/reference/actor-builds/build-log/get-log
63+
64+
Returns:
65+
LogClient: A client allowing access to the log of this actor build.
66+
"""
67+
return LogClient(
68+
**self._sub_resource_init_options(resource_path='log'),
69+
)
70+
5871

5972
class BuildClientAsync(ActorJobBaseClientAsync):
6073
"""Async sub-client for manipulating a single actor build."""
@@ -103,3 +116,15 @@ async def wait_for_finish(self: BuildClientAsync, *, wait_secs: int | None = Non
103116
(SUCEEDED, FAILED, TIMED_OUT, ABORTED), then the build has not yet finished.
104117
"""
105118
return await self._wait_for_finish(wait_secs=wait_secs)
119+
120+
def log(self: BuildClientAsync) -> LogClientAsync:
121+
"""Get the client for the log of the actor build.
122+
123+
https://docs.apify.com/api/v2/#/reference/actor-builds/build-log/get-log
124+
125+
Returns:
126+
LogClientAsync: A client allowing access to the log of this actor build.
127+
"""
128+
return LogClientAsync(
129+
**self._sub_resource_init_options(resource_path='log'),
130+
)

0 commit comments

Comments
 (0)