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

Keep.sync() marks nodes as synced before they're persisted to the server #162

Open
playhere opened this issue Apr 7, 2024 · 4 comments · May be fixed by #164
Open

Keep.sync() marks nodes as synced before they're persisted to the server #162

playhere opened this issue Apr 7, 2024 · 4 comments · May be fixed by #164
Labels

Comments

@playhere
Copy link

playhere commented Apr 7, 2024

i am using the docker, and i am able to login to google with app password

but after i sync several hundred notes, the 'rate limit exceeded' exception will pop up

i tried to do a exponential resync mechanism, and it turns to impossible because after sync was called, even with exception, next time i run sync, it will run with no exception but the notes are not really synchronized

is it possible to sync the same notes multiple times till the sync succeed?

@kiwiz
Copy link
Owner

kiwiz commented Apr 7, 2024

Afaik, this should work. Please post your code.

@playhere
Copy link
Author

playhere commented Apr 13, 2024

i am reading my evernotes from sqlite db, and try to sync to google keep, i can only sync a couple hundreds notes each time, and have to wait for 1 day or 2 to sync another hundreds.

code: readfromsqlite.txt

Traceback (most recent call last):
File "trysqlite2.py", line 98, in
keep.sync()
File "/usr/local/lib/python3.8/dist-packages/gkeepapi/init.py", line 1025, in sync
self._sync_notes(resync)
File "/usr/local/lib/python3.8/dist-packages/gkeepapi/init.py", line 1055, in _sync_notes
changes = self._keep_api.changes(
File "/usr/local/lib/python3.8/dist-packages/gkeepapi/init.py", line 362, in changes
return self.send(url=self._base_url + "changes", method="POST", json=params)
File "/usr/local/lib/python3.8/dist-packages/gkeepapi/init.py", line 241, in send
raise exception.APIException(error["code"], error)
gkeepapi.exception.APIException: {'code': 403, 'message': 'Rate Limit Exceeded', 'errors': [{'message': 'Rate Limit Exceeded', 'domain': 'usageLimits', 'reason': 'rateLimitExceeded'}]}

the rate limit looks like time related, when wait a week, i can sync like 1000 notes, but if only wait one day, only around 200 notes can by synced.

@kiwiz kiwiz changed the title keep.sync() failed with rate limit exceeded exception, and rerun the sync() will pass with no exception, but the notes are not really synchronized. Keep.sync() marks nodes as synced before they're persistent to the server Apr 13, 2024
@kiwiz kiwiz changed the title Keep.sync() marks nodes as synced before they're persistent to the server Keep.sync() marks nodes as synced before they're persisted to the server Apr 13, 2024
@kiwiz kiwiz linked a pull request Apr 13, 2024 that will close this issue
@kiwiz kiwiz added the bug label Apr 14, 2024
@kiwiz
Copy link
Owner

kiwiz commented Apr 16, 2024

Pushed up a tentative fix. Can you try the sync-fix branch?

@playhere
Copy link
Author

playhere commented Apr 20, 2024

latest code Requires: Python >=3.10

but my docker installed python 3.8.10
updated code can not run in my environment

unable to test the code

import gkeepapi File "/usr/local/lib/python3.8/dist-packages/gkeepapi/__init__.py", line 24, in <module> class APIAuth: File "/usr/local/lib/python3.8/dist-packages/gkeepapi/__init__.py", line 132, in APIAuth def getAuthToken(self) -> str | None: TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

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

Successfully merging a pull request may close this issue.

2 participants