Installation
To install the ActivitySmith Python SDK, you can use pip:Python
Usage
- Create an API key
- Set the API key as an environment variable named
ACTIVITYSMITH_API_KEYor pass it as a parameter to theActivitySmithclass.
Python
Send a Push Notification
Useactivitysmith.notifications.send with a push payload. title is required; message and subtitle are optional.
Python
Start a Live Activity
Start a Live Activity withactivitysmith.live_activities.start.
For segmented_progress, include title, number_of_steps, current_step, and type.
For progress, include title, type: "progress", and either percentage or value plus upper_limit.
Python
Python
Update a Live Activity
Update a Live Activity withactivitysmith.live_activities.update.
Segmented updates require title and current_step. Progress updates require title plus percentage or value with upper_limit.
Python
Python
End a Live Activity
End a Live Activity withactivitysmith.live_activities.end. You can optionally set auto_dismiss_minutes in the content_state.
Python
Python
Channels
You can target specific channels when sending a push or starting a Live Activity.Python
Error Handling
The SDK raises exceptions for non-2xx responses. Rate limit errors use theerror and message fields, and Live Activity limits include limit and active. See Rate Limits for details.