pynder icon indicating copy to clipboard operation
pynder copied to clipboard

how to iterate through the object returned by nearby_users()?

Open brandonbryant12 opened this issue 7 years ago • 4 comments

I tried putting it to a list but that didn't work

brandonbryant12 avatar Mar 17 '18 04:03 brandonbryant12

nearby_users() now returns a generator. Use next() to retrieve the next item inside it. https://docs.python.org/2/library/functions.html#next

RailKill avatar Mar 17 '18 09:03 RailKill

I'm getting stuck on waiting for a response from the api when I call next(users). I modified sessions.py to this:

print("before response) response = self._api.recs(limit) print("after response")

Then when I go to test it I never get to the second print statement

users = session.nearby_users() #executes fine next(users)

brandonbryant12 avatar Mar 17 '18 10:03 brandonbryant12

I encountered the same bug. I cannot see neaby_users at all.

nwatab avatar Apr 26 '18 16:04 nwatab

One way to loop a generator (im new to python so please correct me if im wrong) :

users = session.matches()
for user in users:

luke-robertson avatar Feb 15 '19 15:02 luke-robertson