Learn how to upgrade to v1.0 of the Knock Python SDK.
Initialize your client with the API key:
The v1.0 SDK introduces async support, strong type checking, and improved developer experience for Python applications.
First-class async/await support:
Improved type hints with TypedDict and Pydantic models:
Iterate through paginated resources automatically:
More specific error classes:
Fine-tune request behavior:
Get more control over HTTP interactions:
The new SDK has a cleaner interface with direct method calls. The old approach of passing all parameters as keyword arguments is replaced with specific method signatures. Parameters that were previously named keyword arguments may now be positional arguments.
Several method names have changed:
client.users.identify()
is nowclient.users.update()
client.users.get_user()
is nowclient.users.get()
- Client-level
.notify()
shorthand is removed, useclient.workflows.trigger()
instead client.users.getSchedules()
is nowclient.users.listSchedules()
client.workflows.createSchedules()
is nowclient.schedules.create()
client.workflows.listSchedules()
is nowclient.schedules.list()
client.workflows.updateSchedules()
is nowclient.schedules.update()
client.workflows.deleteSchedules()
is nowclient.schedules.delete()
Bulk operations are now organized in their own namespaces: client.users.bulk.*
, client.objects.bulk.*
, client.schedules.bulk.*
, etc.
Most methods now take the ID(s) as positional parameter(s), followed by named parameters. The data
wrapper is removed for user properties (they're now top-level parameters). Parameter names have changed in some cases (e.g., id
is now user_id
). Preference methods require an explicit preference set ID parameter.
The new SDK returns typed Pydantic model instances instead of dictionaries. Use .model_dump()
to get a dictionary representation of a response object. Pagination is handled via cursor-based pagination instead of page-based.
If you run into any issues during your migration, reach out to our support team or open an issue on GitHub.