kiwiz / gkeepapi

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

Searching for Notes with find() method returns generator object #107

Closed kyrlon closed 3 years ago

kyrlon commented 3 years ago

Adapted from the Searching for Notes section, when attempting to running a search, my return object is a generator object:

ex = self.keep.find(query="Groceries")
print(ex)
<generator object Keep.find.<locals>.<genexpr> at 0x0000025B7864EE40>

My assumption that it would be a return list object as stated from the source code here at this line.

when running the function keep.all() I have no problem returning a list object.

Is there something I may have overlooked?

==============================================================================

Check that you're running the newest version of the library.

 py -m pip freeze | grep gkeep
gkeepapi==0.13.4

If you're providing a stack trace, make sure it doesn't contain your password. No it does not.

If you're getting a KeyError or ParseException, please follow the instructions here to dump the raw data.

I am not getting a KeyError or ParseException.

Operating system

import platform
platform.platform()
'Windows-10-10.0.19041-SP0'

Python version

py --version
Python 3.8.9
kyrlon commented 3 years ago

A quick hotfix is to simply call list on the generator.

list(ex)
print(ex)
[<gkeepapi.node.List ...51EFF9910>]
kiwiz commented 3 years ago

Thanks for the notice! I've updated the docstring in question to say Generator instead (I'm not sure if that's the correct syntax, but it's what Python 3's typing module exposes, at least).