Doist/todoist-api-python

get_projects() causes KeyError on 'can_assign_tasks' key of Project object

abaldwin06 opened this issue · 0 comments

Bug description

.get_projects() and .get_project(id) both cause the following error for all projects on my account:

  File "/Users/Documents/projects/todoist-shuffler/.env/lib/python3.12/site-packages/todoist_api_python/models.py", line 37, in from_dict
    can_assign_tasks=obj["can_assign_tasks"],
                     ~~~^^^^^^^^^^^^^^^^^^^^
KeyError: 'can_assign_tasks'

Expected behaviour

Return a list of projects or a project object

Is reproducible

Yes

To reproduce

>>> from todoist_api_python.api import TodoistAPI
>>> file=open(".apikey","r")
>>> key = file.read()
>>> api = TodoistAPI(key)
>>> projects = api.get_projects()

Steps taken to try to reproduce

Tried the above, but also tried api.get_tasks() which caused no errors
Then I tried finding a shared project ID from my returned tasks and tried
prj = api.get_project(id)
which caused the same issue. Tried same with an unshared project and got the same result.

Version information:

First saw issue with:

  • Package version: 2.0.2
  • Python version: 3.11
    Upgraded to see if this resolved issue and it didn't:
  • Package version: 2.1.4
  • Python version: 3.12.3

Additional information

Didn't see 'can_assign_tasks' as a valid key in a project object in the documentation anywhere