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

JSONDecodeError #3

Open
davidmoshal opened this issue Jul 27, 2024 · 1 comment
Open

JSONDecodeError #3

davidmoshal opened this issue Jul 27, 2024 · 1 comment

Comments

@davidmoshal
Copy link

  • install datasette and this plugin today (ie: latest version)
  • latest Macos
  • set the api token (which is working, I have other Todoist apps using the same token)
  • ran: todoist-to-sqlite sync todoist.db

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/[email protected]/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/[email protected]/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/[email protected]/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
Copy link

nloadholtes commented Nov 4, 2024

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). 🤔

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants