Apify API client for Python providing access to web scraping and automation platform resources
—
Quality
Pending
Does it follow best practices?
Impact
Pending
No eval scenarios have been run
Log access and streaming for Actor runs and builds with real-time monitoring capabilities. Provides comprehensive access to execution logs and diagnostic information.
class LogClient:
def get(self, *, raw: bool = False) -> str | None:
"""Get log as text.
Args:
raw: Whether to return raw log without formatting
"""
def get_as_bytes(self, *, raw: bool = False) -> bytes | None:
"""Get log as raw bytes.
Args:
raw: Whether to return raw log without formatting
"""
def stream(self, *, raw: bool = False) -> Iterator[Response | None]:
"""Stream log as context manager.
Args:
raw: Whether to stream raw log without formatting
"""
class LogClientAsync:
"""Async version of LogClient with identical methods."""from apify_client import ApifyClient
client = ApifyClient('your-api-token')
# Get complete log
log_client = client.log('run-or-build-id')
full_log = log_client.get()
print(full_log)
# Stream log in real-time
with log_client.stream() as log_stream:
for chunk in log_stream:
if chunk:
print(chunk.decode('utf-8'), end='')
# Get raw log bytes for file storage
log_bytes = log_client.get_as_bytes(raw=True)
with open('actor_log.txt', 'wb') as f:
f.write(log_bytes)Install with Tessl CLI
npx tessl i tessl/pypi-apify-client