Starting can be canceled.
You can cancel tasks either by their ID or using a task object.
Canceling by Task ID
Use thecancel_task() method when you have the task ID:
Canceling from TaskResponse Object
If you have a task object, you can cancel it directly using thecancel() method. This method will also return the updated task status:
Async Usage
For async applications, useawait: