Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.add_comment returns 400 Client Error (new task ID formatting?) #131

Open
oscarclivio opened this issue Mar 22, 2024 · 0 comments
Open
Labels
bug Something isn't working

Comments

@oscarclivio
Copy link

oscarclivio commented Mar 22, 2024

Bug description

EDIT : This bug no longer happens on my side, has there been anything?

The api.add_comment method returns 400 Client Error: Bad Request for url: https://api.todoist.com/rest/v2/comments. This started today.

It seems to be due to a new formatting of task IDs. When I click on one of my tasks titled arXiV : 202403190000 - 202403192359, the link is https://app.todoist.com/app/task/ar-xi-v-202403190000-202403192359-7814598409 instead of the classical link with a numerical ID. (EDIT : actually the ID is present)

Expected behaviour

A comment should be added to the supplied task.

Is reproducible

Yes

To reproduce

from todoist_api_python.api import TodoistAPI

api = TodoistAPI("Your API key")

task = api.add_task("This is a task")
print(task.id)
comment = api.add_comment(content="This is a comment",task_id=task.id)
print(comment)

Steps taken to try to reproduce

Tried with the ar-xi-v-202403190000-202403192359-7814598409 part of the aforementionned https://app.todoist.com/app/task/ar-xi-v-202403190000-202403192359-7814598409 link but it did not change the result.

Screenshots

Executing the above code returns the following (first number is the numerical task ID)

7818225037
Traceback (most recent call last):
  File "/home/clivio/comments_todoist.py", line 7, in <module>
    comment = api.add_comment(
              ^^^^^^^^^^^^^^^^
  File "/home/clivio/miniconda3/envs/balancing/lib/python3.11/site-packages/todoist_api_python/api.py", line 161, in add_comment
    comment = post(self._session, endpoint, self._token, data=data)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/clivio/miniconda3/envs/balancing/lib/python3.11/site-packages/todoist_api_python/http_requests.py", line 47, in post
    response.raise_for_status()
  File "/home/clivio/miniconda3/envs/balancing/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://api.todoist.com/rest/v2/comments

Version information:

  • Package version: 2.1.3
  • Python version: 3.11.4

Additional information

NA

@oscarclivio oscarclivio added the bug Something isn't working label Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant