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
Schedule management for automated Actor and task executions with cron-like functionality. Schedules enable periodic execution of Actors and tasks.
class ScheduleClient:
def get(self) -> dict | None:
"""Get schedule information."""
def update(self, **kwargs) -> dict:
"""Update schedule configuration.
Args:
name (str, optional): Schedule name
cron_expression (str, optional): Cron expression for timing
is_enabled (bool, optional): Whether schedule is active
actions (list, optional): Actions to execute
timezone (str, optional): Timezone for schedule
**kwargs: Additional schedule parameters
"""
def delete(self) -> None:
"""Delete schedule."""
def get_log(self) -> list | None:
"""Get schedule execution log."""
class ScheduleClientAsync:
"""Async version of ScheduleClient with identical methods."""
class ScheduleCollectionClient:
def list(
self,
*,
limit: int | None = None,
offset: int | None = None,
desc: bool | None = None
) -> ListPage[dict]:
"""List schedules.
Args:
limit: Maximum number of schedules
offset: Pagination offset
desc: Sort in descending order
"""
def create(self, **kwargs) -> dict:
"""Create new schedule.
Args:
name (str): Schedule name
cron_expression (str): Cron timing expression
is_enabled (bool, optional): Whether to enable immediately
actions (list): List of actions to execute
timezone (str, optional): Schedule timezone
**kwargs: Additional schedule configuration
"""
class ScheduleCollectionClientAsync:
"""Async version of ScheduleCollectionClient with identical methods."""from apify_client import ApifyClient
client = ApifyClient('your-api-token')
# Create daily schedule
schedule = client.schedules().create(
name='Daily Data Collection',
cron_expression='0 9 * * *', # Every day at 9 AM
is_enabled=True,
timezone='America/New_York',
actions=[{
'type': 'RUN_ACTOR_TASK',
'actorTaskId': 'my-task-id',
'input': {'date': '{{now}}'}
}]
)
print(f"Created schedule: {schedule['id']}")
# Monitor schedule executions
schedule_client = client.schedule(schedule['id'])
log = schedule_client.get_log()
for entry in log:
print(f"{entry['createdAt']}: {entry['status']}")Install with Tessl CLI
npx tessl i tessl/pypi-apify-client