Doist/todoist-api-python

api v2.0.0 no longer returns tasks using the filter property of get_tasks

drbayer opened this issue · 3 comments

Bug description

On version 1.1.1, get_tasks(filter='#Home') would return a list of tasks. On version 2.0.0 it returns an empty list.

Expected behaviour

I expect the same list to return with either version of the API.

Is reproducible

Yes

To reproduce

The following script demonstrates the issue:

#!/usr/bin/env python3

from todoist_api_python.api import TodoistAPI
import os

todoist_search_string = '#Home'

# Todoist API key stored in ~/.ssh/todoist
todoist_key_file = os.path.join(os.path.expanduser('~'), '.ssh', 'todoist')

with open(todoist_key_file, 'r') as f:
    todoist_api_key = f.read().splitlines()[0]

todoist = TodoistAPI(todoist_api_key)

todoist_tasks = todoist.get_tasks(filter=todoist_search_string)
print(len(todoist_tasks))

Steps taken to try to reproduce

Reverting to version 1.1.1 fixes the problem.

Screenshots

$ pip list | grep todoist
todoist-api-python 2.0.0
$ ./todoist_test.py
0
$ pip uninstall todoist-api-python && pip install todoist-api-python==1.1.1
...
$ pip list | grep todoist
todoist-api-python 1.1.1
$ ./todoist_test.py
13

Version information:

  • Package version: 2.0.0
  • Python version: 3.10.6

I have found this to be an issue too. Is this going to be actively worked on?

Hi, I tried to reproduce the bug but the result was as expected.

from mysecret import secret
from todoist_api_python.api import TodoistAPI

api = TodoistAPI(secret)

result = api.get_tasks(filter="#Trabalho") # Trabalho means work in portuguese
print(len(result))
> poetry run python3 test_api.py
26

I've tried removing the filter and got 150 (max amount of active tasks).

> poetry run pip3 list | grep todoist-api
todoist-api-python            2.0.0

It works for me now - I haven't looked at this issue in quite some time. Looking at my commit history for the repo where I use this, it appears to have worked at least since December 2022, and I forgot to revisit this issue.