Skip to content
This repository has been archived by the owner on Feb 21, 2022. It is now read-only.

Throttling and response status codes. #100

Open
stacksjb opened this issue Jan 11, 2022 · 3 comments
Open

Throttling and response status codes. #100

stacksjb opened this issue Jan 11, 2022 · 3 comments
Labels

Comments

@stacksjb
Copy link

stacksjb commented Jan 11, 2022

Hello,

I have been working on a python sync script to sync Todoist and Canvas tasks, which has been working quite well.

Today I got busy trying to code some additional features into my script, and it suddenly quit working. When I tried to log into Todoist on the web to check, I got error message

"Error: {"error":"Too many requests. Limits reached. Try again later","error_code":35,"error_extra":{"event_id":"703f9f8f1553433c815aa1cbd5d8fe58","retry_after":513},"error_tag":"LIMITS_REACHED","http_code":429} Event ID: 12405665f4884a32b7438ae9d09e4cc9

It is now 6+ hours later, and while the desktop and web client functionality seems to have returned, the submitted tasks from my script are still not showing up in the WebUI, and executing print(todoist_api) after running todoist.api.commit() returns TodoistAPI(<not synchronized>)

I could not locate any documentation on this response, can anyone point me towards a more verbose output or anything that might help me determine what might be going on?

@goncalossilva
Copy link
Member

This looks like a bug. Since the response body from 429 is valid JSON, we might be parsing it correctly here. Problem is, we seem rely on this failing (and throwing) to do error handling. Without it, the SDK assumes it was able to sync, and tasks will be lost. We should check for unexpected response codes (4XX/5XX) and act accordingly.

Are you able to reinitiate sync for the missing tasks? The library doesn't know about them anymore, judging from that output. 😕

@stacksjb
Copy link
Author

I agree, I've run into this with lots of other libraries where I have needed to add "if response.statuscode =" into the logic.

Based on https://developer.todoist.com/rest/v1/#overview, we should be flagging anything that is not a 2xx response (typical response should be 200 or 204), a 4xx or 5xx response should be considered incomplete.

@stacksjb
Copy link
Author

I attempted to reinstate sync but it continue to fail; I attempted with another account and then another apikey and they both worked.

So it looks like if you annoy the Todoist API too much you might need to regenerate your APIkey to get things working again.

@stacksjb stacksjb changed the title Questions regarding throttling? Throttling and response status codes. Jan 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants