bcongdon / todoist-to-sqlite

Export your Todoist data to SQLite
MIT License
16 stars 3 forks source link

JSONDecodeError #3

Open davidmoshal opened 3 months ago

davidmoshal commented 3 months ago

resulted in this error:

Traceback (most recent call last): File "/opt/homebrew/lib/python3.11/site-packages/requests/models.py", line 974, in json return complexjson.loads(self.text, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.11/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.11/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.11/3.11.9_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/opt/homebrew/bin/todoist-to-sqlite", line 8, in sys.exit(cli()) ^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(args, *kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/todoist_to_sqlite/cli.py", line 75, in sync sync_data = api.sync(api_token=token, sync_token="").json() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/lib/python3.11/site-packages/requests/models.py", line 978, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

nloadholtes commented 1 week ago

I just ran into the same issue on linux and I think it's a problem with the pytodoist package. I put a breakpoint in and looked at the output of api.sync(api_token=token, sync_token="") and it was a 410 reponse object with the text:

"This endpoint is deprecated.\n\nIf you're reading this on a browser, there's a good chance you can change\nthe v8 part on the URL to v9 and get away with it. ;)\n\nIf you're using the API directly, please update your use case to rely\non the new API endpoints, available under /sync/v9/ or /rest/v2/ prefixes.\n\nFor more details, please see documentation at\nhttps://developer.todoist.com/guides/#our-apis\n\n"

in the debugger I tried setting the api by doing api.URL='https://api.todoist.com/API/v9/' and that resulted in a 403 (and the same text message as the 410). :thinking:

The "bad" news is that the pytodoist package looks like it has not been updated in a while.

I went and looked for an alternative todoist package and it looks like the "offical" one is https://github.com/Doist/todoist-api-python