kiwiz / gkeepapi

An unofficial client for the Google Keep API.
MIT License
1.54k stars 114 forks source link

Can't work out how to get a note that is a list #74

Closed WhatDoor closed 4 years ago

WhatDoor commented 4 years ago

Hi,

I'm not sure if I understand the docs correctly, but I am trying to use keep.get('XXX') to get a note that is a list. I managed to get it working for regular notes, but for some reason i can't get lists.

Any help would be appreciated

kiwiz commented 4 years ago

Hi, keep.get() should work lists as well - I just tested and confirmed this. Can you provide any addn info?

WhatDoor commented 4 years ago
import gkeepapi
import keyring
import sys

user = 'WhatDoor@hotmail.com'
pw = keyring.get_password('google_keep', user)

keep = gkeepapi.Keep()
keep.login(user, pw)

listNode = keep.get('1y4oicjz_V1EIUwIumbDQPAI69m0zeMse7Yqq_Gg-mhhxmbqdI2NyarTruzqhBQ')

list = listNode.items

print(list[0].text)

keep.sync()

I'm not sure what you mean by addn info, but this is the script i am currently testing. When I run this, nothing happens, the script just gets stuck and doesn't terminate.

EDIT: When I used keyboard interrupt to terminate the process, it finally printed the expected output, but there was also a stacktrace.

item1
Traceback (most recent call last):
  File "D:\Anaconda\lib\site-packages\urllib3\connectionpool.py", line 380, in _make_request
TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Full Google Drive Sync\Drive\tech projects\MyScripts\Script_Resources\gapitest.py", line 17, in <module>

  File "D:\Anaconda\lib\site-packages\gkeepapi\__init__.py", line 873, in sync
    labels=[i.save() for i in self._labels.values()] if labels_updated else None,
  File "D:\Anaconda\lib\site-packages\gkeepapi\__init__.py", line 358, in changes
    json=params
  File "D:\Anaconda\lib\site-packages\gkeepapi\__init__.py", line 220, in send
    response = self._send(**req_kwargs).json()
  File "D:\Anaconda\lib\site-packages\gkeepapi\__init__.py", line 263, in _send
    return self._session.request(**req_kwargs)
  File "D:\Anaconda\lib\site-packages\requests\sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\Anaconda\lib\site-packages\requests\sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "D:\Anaconda\lib\site-packages\requests\adapters.py", line 440, in send
    timeout=timeout
  File "D:\Anaconda\lib\site-packages\urllib3\connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "D:\Anaconda\lib\site-packages\urllib3\connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "D:\Anaconda\lib\http\client.py", line 1331, in getresponse
    response.begin()
  File "D:\Anaconda\lib\http\client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "D:\Anaconda\lib\http\client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "D:\Anaconda\lib\socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "D:\Anaconda\lib\site-packages\urllib3\contrib\pyopenssl.py", line 280, in recv_into
    return self.connection.recv_into(*args, **kwargs)
  File "D:\Anaconda\lib\site-packages\OpenSSL\SSL.py", line 1714, in recv_into
    result = _lib.SSL_read(self._ssl, buf, nbytes)
KeyboardInterrupt
WhatDoor commented 4 years ago

Ah nevermind, I got it working - i was confused about where to add new entries and was attempting to add them to the list object after calling node.items instead of just calling add on the node itself.

Still not sure what that stacktrace is about though...