You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using the api.delete_task() function reports success but task are still present
Expected behaviour
when executing the api.delete_task() twice I would expect an error for the second call as task should be already deleted
Is reproducible
Yes
To reproduce
Code Snipplet:
from todoist_api_python.api import TodoistAPI
api = TodoistAPI(key)
I receive a list of completed task via the REST API as this does not work with the python module. I get a python dict clist, then:
for c in clist:
print('Delete item: ',c['content'],c['task_id'])
try:
is_success = api.delete_task(task_id=c['task_id'])
print(is_success)
except Exception as error:
print(error)
works fine, but when I run the script a second time all "deleted" tasks are back again
Version information:
Package version: 8.1.3
Python version: 3.10
Additional information
The text was updated successfully, but these errors were encountered:
actually the problem is not for the python module but for all API calls! Whether using the Sync V9 or REST V2 API it is not possible to delete tasks. Looks like this intentional by the company to preserve your data for commercial reasons?
The problem is not that you're unable to delete tasks. The problem is that the API does not check if the task exists before deleting it. Here's a code sample to demonstrate this behavior.
frommysecretimportsecretfromtodoist_api_python.apiimportTodoistAPIimportnumpyasnpapi=TodoistAPI(secret)
try:
is_success=api.delete_task(task_id=str(np.random.randint(1e2, 1e8))) # some fake idprint(is_success)
exceptExceptionaserror:
print(error)
> poetry run python3 test_api.py
True
I did not develop the API therefore I do not know if this is the intended behavior of the API, but it is easily fixable and, in my opinion, the SDKs should check if the task exists before deleting it.
I've managed to delete tasks using both the Python SDK and the REST v2 endpoint directly, so this is not the problem.
Using the REST v2 API w/ postman
The response is 204 and the task was indeed deleted.
Bug description
using the api.delete_task() function reports success but task are still present
Expected behaviour
when executing the api.delete_task() twice I would expect an error for the second call as task should be already deleted
Is reproducible
Yes
To reproduce
Code Snipplet:
I receive a list of completed task via the REST API as this does not work with the python module. I get a python dict clist, then:
works fine, but when I run the script a second time all "deleted" tasks are back again
Version information:
Additional information
The text was updated successfully, but these errors were encountered: