kiwiz / gkeepapi Goto Github PK
View Code? Open in Web Editor NEWAn unofficial client for the Google Keep API.
License: MIT License
An unofficial client for the Google Keep API.
License: MIT License
Traceback (most recent call last):
File "gkeep.py", line 13, in <module>
keep.sync()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gkeepapi/__init__.py", line 449, in sync
labels=[i.save() for i in self._labels.values()] if labels_updated else None,
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gkeepapi/__init__.py", line 211, in changes
json=params
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/gkeepapi/__init__.py", line 131, in send
raise LoginException('Not logged in')
gkeepapi.LoginException: Not logged in
I haven't changed my code since last night.
I'm trying out gkeepapi
using the example code from the README, but I'm getting the following error:
Traceback (most recent call last):
File "test.py", line 4, in <module>
success = keep.login('*************@gmail.com', 'apppasswordhere')
File "mydirectory/keepEnv/lib/python3.5/site-packages/gkeepapi/__init__.py", line 404, in login
self.load(auth)
File "mydirectory/keepEnv/lib/python3.5/site-packages/gkeepapi/__init__.py", line 418, in load
self.sync(True)
File "mydirectory/keepEnv/lib/python3.5/site-packages/gkeepapi/__init__.py", line 645, in sync
self._parseNodes(changes['nodes'])
File "mydirectory/keepEnv/lib/python3.5/site-packages/gkeepapi/__init__.py", line 672, in _parseNodes
node = _node.from_json(raw_node)
File "mydirectory/keepEnv/lib/python3.5/site-packages/gkeepapi/node.py", line 1450, in from_json
node.load(raw)
File "mydirectory/keepEnv/lib/python3.5/site-packages/gkeepapi/node.py", line 1027, in load
self._title = raw['title']
KeyError: 'title'
I can see in my app passwords that this password has been used, so I'm assuming I am logging in successfully. I also tried keepcli and got the same error.
Any solution? Thanks in advance.
This API no longer lets me log in - I always get a BadAuthentication exception. For example, from my log:
2018-08-13 01:01:45.927546: Logging in...
2018-08-13 01:01:46.184282: Exception!
2018-08-13 01:01:46.186899: type(exc) - <class 'gkeepapi.exception.LoginException'>
2018-08-13 01:01:46.187836: exc - ('BadAuthentication', None)
2018-08-13 01:01:46.188545: exc.args - ('BadAuthentication', None)
2018-08-13 01:01:46.189264: Sleeping for 15 minutes...
This has simultaneously stopped working on all my computers. I was using an app password generated from Google -- just tried to regenerate a new one and no luck.
Has Google torched this API?
File "import.py", line 10, in
success = keep.login(username,password)
File "/usr/local/lib/python3.6/site-packages/gkeepapi/init.py", line 348, in login
self.load(auth)
File "/usr/local/lib/python3.6/site-packages/gkeepapi/init.py", line 362, in load
self.sync()
File "/usr/local/lib/python3.6/site-packages/gkeepapi/init.py", line 565, in sync
self._parseUserInfo(changes['userInfo'])
File "/usr/local/lib/python3.6/site-packages/gkeepapi/init.py", line 628, in _parseUserInfo
node.load(label)
File "/usr/local/lib/python3.6/site-packages/gkeepapi/node.py", line 1353, in load
self._revision = raw['revision']
KeyError: 'revision'
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import gkeepapi
>>> import getpass
>>> gkeepapi.Keep()
<gkeepapi.Keep object at 0x000001B86923C438>
>>> keep = _
>>> keep.login("********@********", getpass.getpass())
Password:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\EcmaXp\AppData\Roaming\Python\Python36\site-packages\gkeepapi\__init__.py", line 363, in login
ret = auth.login(username, password, get_mac())
File "C:\Users\EcmaXp\AppData\Roaming\Python\Python36\site-packages\gkeepapi\__init__.py", line 67, in login
raise LoginException(res.get('Error'), res.get('ErrorDetail'))
gkeepapi.LoginException: ('NeedsBrowser', 'To access your account, you must sign in on the web. Touch Next to start browser sign-in.')```
The most frustrating thing i have found about this API at the moment is the way it needs to load the entire library every time it starts up.
I know this is necessary to populate the node tree, but is there a way to pass a parameter of a "database file", sqlite, or json, which the API bases it's queries on, and only has to partially update every time the API is asked to sync?
I am able to login using the gkeepapi on some of my google accounts. But on one other account, I get the following error on python3.5
>> keep = gkeepapi.Keep()
>> keep.login(username,password)
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
<ipython-input-15-b8a8ccaeb1f2> in <module>()
----> 1 keeparjun.login('...','...')
/usr/local/lib/python3.5/dist-packages/gkeepapi/__init__.py in login(self, username, password, state, sync)
470 ret = auth.login(username, password, get_mac())
471 if ret:
--> 472 self.load(auth, state, sync)
473
474 return ret
/usr/local/lib/python3.5/dist-packages/gkeepapi/__init__.py in load(self, auth, state, sync)
515 self.restore(state)
516 if sync:
--> 517 self.sync(True)
518
519 def dump(self):
/usr/local/lib/python3.5/dist-packages/gkeepapi/__init__.py in sync(self, resync)
775
776 if 'nodes' in changes:
--> 777 self._parseNodes(changes['nodes'])
778
779 self._keep_version = changes['toVersion']
/usr/local/lib/python3.5/dist-packages/gkeepapi/__init__.py in _parseNodes(self, raw)
804
805 else:
--> 806 node = _node.from_json(raw_node)
807 if node is None:
808 logger.debug('Discarded unknown node')
/usr/local/lib/python3.5/dist-packages/gkeepapi/node.py in from_json(raw)
1650 return None
1651 node = ncls()
-> 1652 node.load(raw)
1653 return node
1654
/usr/local/lib/python3.5/dist-packages/gkeepapi/node.py in load(self, raw)
1550 def load(self, raw):
1551 super(Blob, self).load(raw)
-> 1552 self.blob = self.from_json(raw.get('blob'))
1553
1554 def save(self, clean=True):
/usr/local/lib/python3.5/dist-packages/gkeepapi/node.py in from_json(cls, raw)
1545 return None
1546 blob = bcls()
-> 1547 blob.load(raw)
1548 return blob
1549
/usr/local/lib/python3.5/dist-packages/gkeepapi/node.py in load(self, raw)
1473 self._extracted_text = raw.get('extracted_text')
1474 self._extraction_status = raw.get('extraction_status')
-> 1475 self._drawing_info.load(raw['drawingInfo'])
1476
1477 def save(self, clean=True):
/usr/local/lib/python3.5/dist-packages/gkeepapi/node.py in load(self, raw)
1498 self.snapshot.load(raw['snapshotData'])
1499 self._snapshot_fingerprint = raw['snapshotFingerprint']
-> 1500 self._thumbnail_generated_time = NodeTimestamps.str_to_dt(raw['thumbnailGeneratedTime'])
1501 self._ink_hash = raw['inkHash']
1502 self._snapshot_proto_fprint = raw['snapshotProtoFprint']
Very nice api!
I've been working on a little CLI mostly for myself https://github.com/mgckind/keepcli based on your excellent work.
Recently, Google Keep supports nested lists. Is there a plan to add this?
Thanks!
I am trying to run the following code on linux Ubuntu with IDLE .When I compile and run this code I get "Unknown blob type: None" error.
import gkeepapi
import getpass
keep = gkeepapi.Keep()
success = keep.login('@gmail.com','****')
labels = keep.labels()
gnotes = keep.find(labels=["grammar"])
for x in gnotes:
print(x.text)
RESTART: /home/q/s.py
Unknown blob type: None
How can I fix this error?
Log in an account with a label
File "/Library/Python/2.7/site-packages/gkeepapi/__init__.py", line 348, in login
self.load(auth)
File "/Library/Python/2.7/site-packages/gkeepapi/__init__.py", line 362, in load
self.sync()
File "/Library/Python/2.7/site-packages/gkeepapi/__init__.py", line 566, in sync
self._parseUserInfo(changes['userInfo'])
File "/Library/Python/2.7/site-packages/gkeepapi/__init__.py", line 629, in _parseUserInfo
node.load(label)
File "/Library/Python/2.7/site-packages/gkeepapi/node.py", line 1353, in load
self._revision = raw['revision']
KeyError: 'revision'
FYI, userInfo looks like this now:
{u'timestamps': {u'kind': u'notes#timestamps'}, u'contextualCoachmarksAcked': [u'keep_it_cc'], u'labels': [{u'timestamps': {u'updated': u'2018-04-27T09:37:43.175Z', u'created': u'2018-04-27T09:37:42.417Z'}, u'name': u'test', u'mainId': u'tag.0yhepizup3b1.16306772811'}], u'settings': {u'singleSettings': [{u'applicablePlatforms': [u'ANDROID', u'WEB', u'CRX', u'IOS', u'CRX_BA'], u'type': u'WEB_EMBEDS_ENABLED', u'webEmbedsEnabledValue': True}, {u'globalCheckedListItemsPolicyValue': u'GRAVEYARD', u'applicablePlatforms': [u'ANDROID', u'WEB', u'CRX', u'IOS', u'CRX_BA'], u'type': u'GLOBAL_CHECKED_LIST_ITEMS_POLICY'}, {u'applicablePlatforms': [u'ANDROID', u'WEB', u'CRX', u'IOS', u'CRX_BA'], u'globalNewListItemPlacementValue': u'BOTTOM', u'type': u'GLOBAL_NEW_LIST_ITEM_PLACEMENT'}, {u'applicablePlatforms': [u'ANDROID', u'WEB', u'CRX', u'IOS', u'CRX_BA'], u'type': u'SHARING_ENABLED', u'sharingEnabledValue': True}, {u'layoutStyleValue': u'GRID', u'applicablePlatforms': [u'ANDROID', u'WEB', u'CRX', u'IOS', u'CRX_BA'], u'type': u'LAYOUT_STYLE'}]}}
Until a keep account is opened by the chrome app and refreshed (sync/merge) then a KeyError: 'lastMerged' error occurs on a sync() call after a successful sign in.
Traceback (most recent call last):
File "test.py", line 14, in
keep.sync()
File "......\gkeepapi_init_.py", line 457, in sync
self.parseUserInfo(changes['userInfo'])
File "......\gkeepapi_init.py", line 520, in _parseUserInfo
node.load(label)
File "......\gkeepapi\node.py", line 1345, in load
self._load(raw) # pylint: disable=protected-access
File "......\gkeepapi\node.py", line 1287, in load
self._merged = NodeTimestamps.str_to_dt(raw['lastMerged'])
KeyError: 'lastMerged'
The API documentation says to use login() to log in, then sync() periodically to make changes.
What happens if, for instance, the connection is dropped in between the login() and sync() calls? Will sync() automatically re-login, or does it silently fail?
If the latter, is there some way to check login() status to know if we need to login again?
The use case for this is, I'm trying to keep a Keep note synced with a KDE Plasma note. I have a script running that periodically checks, every 5 minutes or so, if the note has changed to sync the two. So my question is, should I just send a new login() request every 5 minutes? Or should I just login() once, then every five minutes call sync()? Or login() once, then every five minutes check login status and possibly re-login again, and then call sync()? etc.
I can't find anything on this in the documentation, so it might be good to add something there.
I'm using this for the first time, but having poor results.
import gkeepapi
keep = gkeepapi.Keep()
keep.login(username, password)
gnote = keep.get('15fb415844b.8224185fe3855046')
print(gnote)
This produces "None" when there's definitely stuff in that note.
I am not able to sync my data during the login.
It seems to have something to do with the audionotes I made recently. I suspect they didn't get recorded correctly.
Here is my code:
import gkeepapi
keep = gkeepapi.Keep()
keep.login(...)
My Error:
KeyError: 'length'
The above exception was the direct cause of the following exception:
ParseException: Parse error in <class 'gkeepapi.node.NodeAudio'>
Raw Data:
{'kind': 'notes#blob', 'type': 'AUDIO', 'mimetype': 'audio/3gpp', 'byte_size': 14342, 'is_uploaded': True}
What needs to happen to get Google Keep notes? I'd be happy to help if pointed in the right direction!
Hey,
I live in Sydney, Australia, and signing in can often take up to 6 or 7 seconds. I was wondering if this could possibly be due to gkeepapi only communicating with US authentication servers. If this is the case, an optional setting to change this would be great.
I am happy to implement this myself if someone can point me in the right direction.
Thanks 😄
Please make sure you've done the following before submitting your issue:
Reproduction Steps:
Expected Behaviour:
The note should be altered.
Observed Response:
The note was not modified - but the sync function seemed to complete successfully.
Is the api able to check/unckeck an item from a list in an existing note? This feature would be really nice.
Great job!
When trying keep.login I get the following error:
gkeepapi.exception.LoginException: (u'NeedsBrowser', u'To access your account, you must sign in on the web. Touch Next to start browser sign-in.')
I am running the script from Raspbian with Python 2.7.9.
It looks like the 'labels' parameter doesn't work for find here. The label is found but not the notes.
In [131]: keep.findLabel('Work')
Out[131]: <gkeepapi.node.Label at 0x103a567f0>
In [132]: list(keep.find(labels=[keep.findLabel('Work')]))
Out[132]: []
Hi,
I was rather hoping I might be able to port bits of the library to Google Apps Scripts, access to Keep is a sorely missed feature. I'd like to help however I realise I'm in a bit over my head as I don't have much experience with OAuth and I have too many projects on the go at the moment. As a first step I was hoping to rip out the tokens from the Python implementation, and then just separate the requests from the library and send them off with the tokens, refreshing if needed but on first appearances I assume I would need to port a significant amount of the gpsoauth
library too. There is a node version but anyway, as I'm not familiar with the internal workings, do you think this would be feasible at all and is there any chance it could happen in the future?
Thanks
I can't seem to Login I Keep getting this gkeepapi.LoginException: Not logged in
Exception
Traceback (most recent call last):
File "keep.py", line 45, in <module>
keep.sync()
File "/Library/Python/2.7/site-packages/gkeepapi/__init__.py", line 449, in sync
labels=[i.save() for i in self._labels.values()] if labels_updated else None,
File "/Library/Python/2.7/site-packages/gkeepapi/__init__.py", line 211, in changes
json=params
File "/Library/Python/2.7/site-packages/gkeepapi/__init__.py", line 131, in send
raise LoginException('Not logged in')
gkeepapi.LoginException: Not logged in
Am I missing something?
Edit: Tried adding delay after Login using time.sleep(10)
, Still got the same exception.
Images in notes are not fetched after Keep.login(). Will this be added ?
It seems search works on local note caches. Do we have scaling concerns with large number of notes ? Is there a way to download notes based on search criterions, e.g, notes created/updated in last week. (or after certain days).
I am receiving the following APIException on multiple computers after being able to log in and use the API earlier today. I am able to successfully login using Google App passwords, but the error seems to occur during the initial sync.
Using Python 3.6.3 and gkeepapi-0.10.2:
import gkeepapi
keep = gkeepapi.Keep()
login_success = keep.login(my_username, my_app_password)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): android.clients.google.com
DEBUG:urllib3.connectionpool:https://android.clients.google.com:443 "POST /auth HTTP/1.1" 200 None
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): android.clients.google.com
DEBUG:urllib3.connectionpool:https://android.clients.google.com:443 "POST /auth HTTP/1.1" 200 None
DEBUG:keep:Starting sync: None
DEBUG:keep:Syncing 0 labels and 0 nodes
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): www.googleapis.com
DEBUG:urllib3.connectionpool:https://www.googleapis.com:443 "POST /notes/v1/changes HTTP/1.1" 400 None
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda3\lib\site-packages\gkeepapi\__init__.py", line 347, in login
self.sync()
File "C:\Anaconda3\lib\site-packages\gkeepapi\__init__.py", line 543, in sync
labels=[i.save() for i in self._labels.values()] if labels_updated else None,
File "C:\Anaconda3\lib\site-packages\gkeepapi\__init__.py", line 249, in changes
json=params
File "C:\Anaconda3\lib\site-packages\gkeepapi\__init__.py", line 173, in send
raise APIException(error['code'], error)
gkeepapi.APIException: {'errors': [{'domain': 'global', 'reason': 'invalid', 'message': 'Invalid Value'}], 'code': 400, 'message': 'Invalid Value'}
Hi,
If i created a note locally at 11:22, and synced it at 11:24, the server will record 11:24 as creation time. It seems to ignore the create & update timestamps sent by gkeepapi.
Example code to reproduce the problem :
import gkeepapi
import time
keep = gkeepapi.Keep()
keep.login('[email protected]', 'YYYYYYYYY')
keep.createNote('Title', 'Text')
print("SLEEP")
time.sleep(120)
keep.sync()
print("DONE")
I dumped the outgoing http requests sent by the changes() function of KeepAPI, and the timestamps were right (they were at 11:22). But the server didn't take them into account.
If i intercept the sync request and modify the timestamps, to set them one hour ago for example, i see that the server clearly ignores them.
Timestamps accuracy is important for my use of gkeepapi. Any clue ? Thanks !
I'm getting the following error when calling keep.login():
File "/home/sidharth/.local/share/virtualenvs/book-notes-downloader-2kIMB8p_/lib/python3.6/site-packages/gkeepapi/node.py", line 645, in load
self._checked_listitems_policy = CheckedListItemsPolicyValue(raw['checkedListItemsPolicy'])
File "/home/sidharth/.local/share/virtualenvs/book-notes-downloader-2kIMB8p_/lib/python3.6/enum.py", line 291, in __call__
return cls.__new__(cls, value)
File "/home/sidharth/.local/share/virtualenvs/book-notes-downloader-2kIMB8p_/lib/python3.6/enum.py", line 533, in __new__
return cls._missing_(value)
File "/home/sidharth/.local/share/virtualenvs/book-notes-downloader-2kIMB8p_/lib/python3.6/enum.py", line 546, in _missing_
raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 'DEFAULT' is not a valid CheckedListItemsPolicyValue
It appears that raw['checkedListItemsPolicy']
is "DEFAULT", but the current code allows only the value GRAVEYARD.
Do you know why this might be?
Version: current master branch.
Throws a KeyError: 'isArchived' error until all old items are archived. Items can be unarchived afterwards with no error. Needs an invalid value check on key.
Traceback (most recent call last):
File "test.py", line 14, in
keep.sync()
File "......\gkeepapi_init_.py", line 460, in sync
self.parseNodes(changes['nodes'])
File "......\gkeepapi_init.py", line 484, in _parseNodes
node = _node.from_json(raw_node)
File "......\gkeepapi\node.py", line 44, in from_json
node.load(raw)
File "......\gkeepapi\node.py", line 1345, in load
self._load(raw) # pylint: disable=protected-access
File "......\gkeepapi\node.py", line 959, in load
self._archived = raw['isArchived']
KeyError: 'isArchived'
anybody having trouble adding labels? this code used to work. i am running the latest version of gkeepapi.
File "C:\Users\jason\Google Drive\python\keep_calls2.py", line 35, in make_blank_calls
note.labels.add('calls')
File "C:\Python27\lib\site-packages\gkeepapi\node.py", line 838, in add
self._labels[label.id] = label
AttributeError: 'str' object has no attribute 'id'
Hi
I have this :
keep = gkeepapi.Keep()
try:
keep.login(GAppUser, GAppPass)
except Exception as e:
print(e)
and get this :
'blob'
what does it mean ? and why ?
thank you 🌹
Its undocumented, and I could not find a reliable way to access elements of a list in exact same order as they are visible in the google keep. I tried sorting them by Node.sort property but it doesn't work for all my lists. Is there any proper way to achieve it in current version of api?
just installed gkeepapi... it works most of the time... but sometimes, i get this error.
File "C:\Users\jason\Google Drive\python\keep_calls.py", line 22, in make_blank_calls
keep.sync()
File "C:\Python27\lib\site-packages\gkeepapi_init_.py", line 777, in sync
self.parseNodes(changes['nodes'])
File "C:\Python27\lib\site-packages\gkeepapi_init.py", line 806, in _parseNodes
node = _node.from_json(raw_node)
File "C:\Python27\lib\site-packages\gkeepapi\node.py", line 1716, in from_json
ncls = type_map[NodeType(type)]
File "C:\Python27\lib\site-packages\enum_init.py", line 347, in call
return cls.new(cls, value)
File "C:\Python27\lib\site-packages\enum_init.py", line 662, in new
raise ValueError("%s is not a valid %s" % (value, cls.name))
ValueError: None is not a valid NodeType
Traceback (most recent call last):
File "/home/nekmo/Workspace/google-keep-tasks/scripts/google-keep-tasks", line 6, in <module>
cli()
File "/home/nekmo/.virtualenvs/google-keep-tasks/lib/python3.6/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/home/nekmo/.virtualenvs/google-keep-tasks/lib/python3.6/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/home/nekmo/.virtualenvs/google-keep-tasks/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/nekmo/.virtualenvs/google-keep-tasks/lib/python3.6/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/nekmo/.virtualenvs/google-keep-tasks/lib/python3.6/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/home/nekmo/Workspace/google-keep-tasks/google_keep_tasks/note.py", line 12, in edit
success = keep.login(*get_auth())
File "/home/nekmo/.virtualenvs/google-keep-tasks/lib/python3.6/site-packages/gkeepapi/__init__.py", line 264, in login
self.sync()
File "/home/nekmo/.virtualenvs/google-keep-tasks/lib/python3.6/site-packages/gkeepapi/__init__.py", line 466, in sync
self._parseNodes(changes['nodes'])
File "/home/nekmo/.virtualenvs/google-keep-tasks/lib/python3.6/site-packages/gkeepapi/__init__.py", line 490, in _parseNodes
node = _node.from_json(raw_node)
File "/home/nekmo/.virtualenvs/google-keep-tasks/lib/python3.6/site-packages/gkeepapi/node.py", line 1390, in from_json
node = cls()
File "/home/nekmo/.virtualenvs/google-keep-tasks/lib/python3.6/site-packages/gkeepapi/node.py", line 1247, in __init__
super(Blob, self).__init__(type_=NoteType.Blob, parent_id=parent_id, **kwargs)
NameError: name 'NoteType' is not defined
Process finished with exit code 1
I'm not sure if this is just a problem with ink drawings, or true of all nodes, but at the moment the little "Eat Breakfast" sample script fails for me because of a key error at this line:
Line 1566 in fbb52ec
Commenting out that line allows the script to proceed.
Hello everyone.I have installed gkeepapi module by using pip install gkeepapi.But I still get "No module named 'gkeepapi'" error.
import gkeepapi
import getpass
keep = gkeepapi.Keep()
success = keep.login('**@**','**')
labels = keep.labels()
gnotes = keep.find(labels=["activevocabulary"])
for x in gnotes:
print(x.text)
I am using python 3.6.5 and IDLE.
I installed pip3 on Ubuntu and checked:
q@q-ABRA-A5-V12-1:~$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
I installed with gkeepapi with pip3:
pip3 install gkeepapi
But I still get the same error:
========================== RESTART: /home/q/s.py ==========================
Traceback (most recent call last):
File "/home/q/s.py", line 1, in
import gkeepapi
ModuleNotFoundError: No module named 'gkeepapi'
I installed from pip install gkeepapi, the version listed in /usr/local/lib/python2.7/dist-packages/gkeepapi/init.py is 0.11.2
File "test.py", line 4, in
success = keep.login('xxxx', 'xxxxx')
File "/usr/local/lib/python2.7/dist-packages/gkeepapi/init.py", line 472, in login
self.load(auth, state, sync)
File "/usr/local/lib/python2.7/dist-packages/gkeepapi/init.py", line 517, in load
self.sync(True)
File "/usr/local/lib/python2.7/dist-packages/gkeepapi/init.py", line 746, in sync
changes = self._reminders_api.list()
File "/usr/local/lib/python2.7/dist-packages/gkeepapi/init.py", line 384, in list
json=params
File "/usr/local/lib/python2.7/dist-packages/gkeepapi/init.py", line 208, in send
response = self._session.request(**req_kwargs).json()
TypeError: request() got an unexpected keyword argument 'json'
I printed raw in login and see that there's a u:BAD_COOKIE but it also gives me a token.
gkeepapi has access to the reminders api, but we're currently not making use of it. Figure out how to create reminders on notes.
My attempts to use this fail on login:
Traceback (most recent call last):
File "/Users/hans/Dropbox/keep.py", line 7, in
keep.login(USER, PASSWORD)
File "/usr/local/lib/python2.7/site-packages/gkeepapi/init.py", line 472, in login
self.load(auth, state, sync)
File "/usr/local/lib/python2.7/site-packages/gkeepapi/init.py", line 517, in load
self.sync(True)
File "/usr/local/lib/python2.7/site-packages/gkeepapi/init.py", line 777, in sync
self._parseNodes(changes['nodes'])
File "/usr/local/lib/python2.7/site-packages/gkeepapi/init.py", line 806, in _parseNodes
node = _node.from_json(raw_node)
File "/usr/local/lib/python2.7/site-packages/gkeepapi/node.py", line 1723, in from_json
node.load(raw)
File "/usr/local/lib/python2.7/site-packages/gkeepapi/node.py", line 196, in load
self._load(raw)
File "/usr/local/lib/python2.7/site-packages/gkeepapi/node.py", line 1621, in _load
self.blob = self.from_json(raw.get('blob'))
File "/usr/local/lib/python2.7/site-packages/gkeepapi/node.py", line 1615, in from_json
blob.load(raw)
File "/usr/local/lib/python2.7/site-packages/gkeepapi/node.py", line 196, in load
self._load(raw)
File "/usr/local/lib/python2.7/site-packages/gkeepapi/node.py", line 1541, in _load
self._drawing_info.load(raw['drawingInfo'])
File "/usr/local/lib/python2.7/site-packages/gkeepapi/node.py", line 198, in load
raise_from(exception.ParseException('Parse error in %s' % (type(self)), raw), e)
File "/usr/local/lib/python2.7/site-packages/future/utils/init.py", line 456, in raise_from
raise e
gkeepapi.exception.ParseException: Parse error in <class 'gkeepapi.node.NodeDrawingInfo'>
(raw contents attached)
I get an error when logging in with keep.login('[username]', '[password]')
gkeepapi.exception.ParseException
{'drawingId': 'd2af9979-a5d0-40a3-89d8-99717c251aad',
'snapshotData': {'byte_size': 13686,
'extracted_text': '',
'extraction_status': 'SUCCEEDED',
'height': 2048,
'is_uploaded': True,
'kind': 'notes#blob',
'mimetype': 'image/png',
'type': 'IMAGE',
'width': 1316},
'snapshotFingerprint': '4439851323553804410',
'snapshotProtoFprint': '4439851323553804410',
'thumbnailGeneratedTime': '2018-06-27T15:51:11.827Z'}
Full traceback
Traceback (most recent call last):
File "C:\Python35\lib\site-packages\gkeepapi\node.py", line 196, in load
self._load(raw)
File "C:\Python35\lib\site-packages\gkeepapi\node.py", line 1567, in _load
self._ink_hash = raw['inkHash']
KeyError: 'inkHash'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:/STACK/Experiments/random/googlekeep/main.py", line 14, in <module>
keep.login('[username]', '[password]')
File "C:\Python35\lib\site-packages\gkeepapi\__init__.py", line 472, in login
self.load(auth, state, sync)
File "C:\Python35\lib\site-packages\gkeepapi\__init__.py", line 517, in load
self.sync(True)
File "C:\Python35\lib\site-packages\gkeepapi\__init__.py", line 777, in sync
self._parseNodes(changes['nodes'])
File "C:\Python35\lib\site-packages\gkeepapi\__init__.py", line 806, in _parseNodes
node = _node.from_json(raw_node)
File "C:\Python35\lib\site-packages\gkeepapi\node.py", line 1723, in from_json
node.load(raw)
File "C:\Python35\lib\site-packages\gkeepapi\node.py", line 196, in load
self._load(raw)
File "C:\Python35\lib\site-packages\gkeepapi\node.py", line 1621, in _load
self.blob = self.from_json(raw.get('blob'))
File "C:\Python35\lib\site-packages\gkeepapi\node.py", line 1615, in from_json
blob.load(raw)
File "C:\Python35\lib\site-packages\gkeepapi\node.py", line 196, in load
self._load(raw)
File "C:\Python35\lib\site-packages\gkeepapi\node.py", line 1541, in _load
self._drawing_info.load(raw['drawingInfo'])
File "C:\Python35\lib\site-packages\gkeepapi\node.py", line 198, in load
raise_from(exception.ParseException('Parse error in %s' % (type(self)), raw), e)
File "C:\Python35\lib\site-packages\future\utils\__init__.py", line 400, in raise_from
exec(execstr, myglobals, mylocals)
File "<string>", line 1, in <module>
gkeepapi.exception.ParseException: Parse error in <class 'gkeepapi.node.NodeDrawingInfo'>
Very nice work on this API. I tried it real quick and I seem to be able to access my notes. However, when syncing I get the following errors:
Missing key for <class 'gkeepapi.node.Note'> key roleInfo
Missing key for <class 'gkeepapi.node.Note'> key realtimeDataServerVersion
Missing key for <class 'gkeepapi.node.Note'> key realtimeModelVersion
Missing key for <class 'gkeepapi.node.Note'> key lastModifierEmail
Missing key for <class 'gkeepapi.node.Note'> key roleInfo
Missing key for <class 'gkeepapi.node.Note'> key realtimeDataServerVersion
Missing key for <class 'gkeepapi.node.Note'> key realtimeModelVersion
Missing key for <class 'gkeepapi.node.Note'> key lastModifierEmail
I'm only running the following code:
import gkeepapi
keep = gkeepapi.Keep()
keep.login('[user]', '[password]')
keep.sync()
I figured it might be older notes which don't have those attributes or something. So I cleaned a lot of stuff up and made all new notes, still have the same issue.
I'm getting a checkbox list from my Google Keep and assigning it to glist, adding a checked checkbox item and trying to sync. That code is:
glist = keep.get("*********")
glist.add('Item 3', True)
keep.sync()
I get the following error:
File "lib\site-packages\gkeepapi\node.py", line 1176, in load
self._checked = raw['checked']
KeyError: 'checked'
I poked around and it looks like when when line 559 in init.py is run, the variable "changes" is assigned with the checkbox not having a "checked" property. Here is line 559:
changes = self._keep_api.changes(
target_version=self._version,
nodes=[i.save() for i in self._findDirtyNodes()],
labels=[i.save() for i in self._labels.values()] if labels_updated else None,
)
if I stop right before that code is run and run the param snippet from above:
nodes=[i.save() for i in self._findDirtyNodes()]
you can see that the new ListItem has a property "checked = True".
Stepping through line 559 in init.py takes you to line 269 in init.py, it's the return for the self._keep_api.changes()
function:
return self.send(
url=self._base_url + 'changes',
method='POST',
json=params
The response you get from self.send() does not have the "checked" property anymore. It does have a "checked_ts_micro" property with a value of u'1521385638051000'
. It looks like some measure of when the box was checked. If I run the original code with the checked param as False, glist.add('Item 3', False)
,that "checked_ts_micro" property has a value of u'0'
.
This is as far as I gotten with investigating it. Not sure why it doesn't return a "checked" property but it might be an easy fix to just add something like:
if: checked_ts_micro > 0:
self.checked = True
else:
self.checked = False
Throws during login() and also during sync()
{u'drawingId': u'1u6s3cJm8s_JN14haU91d64nEW8GW-eVfbQ', u'snapshotData': {u'mimet
ype': u'image/png', u'kind': u'notes#blob', u'is_uploaded': True, u'byte_size':
107215, u'height': 2048, u'width': 1396, u'extracted_text': u'N\xe1sleduj\xed ro
zvrh popisuje podrobn\u011b Po "T Rok\xe1tio-Radys - \xfatisi.\xf6\xf6ing Tai.zo
isit - n Doma3ominio Stooo TEi i .solind.in noiooDoma cr- Volno ""' . " ""nazor
........zo 15.oo Indiu K\u010d 18:30 p\xe1- Tootnoo 19:15 Doma Eidiv practisei N
et', u'type': u'IMAGE', u'extraction_status': u'FAILED'}, u'snapshotProtoFprint'
: u'9356325366218173475', u'snapshotFingerprint': u'-9090418707491378141', u'ink
Hash': u'945657ddd2b534cd'}
import gkeepapi
def main():
keep = gkeepapi.Keep()
try:
success = keep.login('...', '...')
except gkeepapi.exception.ParseException as e:
print(e.raw)
note = keep.createNote('Todo', 'Eat breakfast')
note.pinned = False
note.color = gkeepapi.node.ColorValue.Red
try:
keep.sync()
except gkeepapi.exception.ParseException as e:
print(e.raw)
if __name__ == "__main__":
main()
I believe this could be resolved by changing "self._TYPE" to "self._TYPE.value" in the following line:
Line 1106 in a46ae07
Hello. First approach to this project.
I get an error when executing keep.login('...','...')
:
gkeepapi.exception.ParseException: Parse error in <class 'gkeepapi.node.NodeDrawingInfo'>
Raw exception prints:
{
u'drawingId':u'1IWjUgVocgWLzF2E42p-xhKfhwwEfUln2DQ',
u'snapshotData':{
u'mimetype':u'image/png',
u'extracted_text':u'',
u'kind':u'notes#blob',
u'type':u'IMAGE',
u'extraction_status':u'DO_NOT_PROCESS'
}
}
Anything useful to you? Let me know if I can help you further debug this. I'm new to Python, but I know my way around code. Thanks!
... which represent the attachments you can add to a note: Drawing, Image, Audio.
The code currently exposes an incomplete read-only interface to this data. The goal is to expose all the fields and possibly allow uploading files.
python 3.4
I used pip to install
Code I Ran:
import gkeepapi
keep = gkeepapi.Keep()
keep.login( MYUSERNAME, MYPASSWORD )
Traceback:
Traceback (most recent call last):
File "", line 1, in
File "C:\Python34\lib\site-packages\gkeepapi-0.10.2-py3.4.egg\gkeepapi_init_.py", line 344, in login
File "C:\Python34\lib\site-packages\gkeepapi-0.10.2-py3.4.egg\gkeepapi_init_.py", line 539, in sync
File "C:\Python34\lib\site-packages\gkeepapi-0.10.2-py3.4.egg\gkeepapi_init_.py", line 249, in changes
File "C:\Python34\lib\site-packages\gkeepapi-0.10.2-py3.4.egg\gkeepapi_init_.py", line 167, in send
TypeError: request() got an unexpected keyword argument 'json'
I can't seem to get keep.get
to work. I've tried using the ID in the note URL as per the docs but I keep getting the error below:
note = keep.get('<ID>')
print note.title
Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'NoneType' object has no attribute 'title'
Doing a print keep.all()
returns note IDs in hex form but they also don't work:
print keep.all()
[<gkeepapi.node.Note object at 0x103268c90>, <gkeepapi.node.Note object at 0x1032796d0>]
Version: default from pip
When I create a label using the Keep.createLabel method, the label name is lowercased when I pull up the Keep webapp.
Reproducer:
import gkeepapi
keep = gkeepapi.Keep()
success = keep.login(...)
label = keep.createLabel('RandomKeep')
keep.sync()
Pull up web interface, and label is named "randomkeep".
After adding App Password I still get a “NeedsBrowser” exception.APIException
Exception message contains URL to open in browser. This url contains usual google 2-step auth page. After providing all steps i got page with nonce. Perhaps i should pass this nonce back to program but i dont know how to do that
I'm getting the following error when running keep.login():
line 851, in load
self._version = raw['baseVersion']
KeyError: 'baseVersion'
The login is successful but when it pulls all the notes and it's setting the properties, it looks like some notes don't have an entry for 'baseVersion' in 'raw' so it fails at the initial sync. Not sure why they wouldn't have a baseVersion or if they do, why it wouldn't get pulled from the server. I looked through the 'raw' dict and it's not every note, and I'm not sure what's different about the ones that don't have it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.