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

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

Open
brandonbryant12 opened this issue Mar 17, 2018 · 4 comments
Open

Comments

@brandonbryant12
Copy link

brandonbryant12 commented Mar 17, 2018

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

@brandonbryant12 brandonbryant12 changed the title nearby_users() method how to iterate through the object returned by nearby_users()? Mar 17, 2018
@RailKill
Copy link

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

@brandonbryant12
Copy link
Author

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)

@nwatab
Copy link

nwatab commented Apr 26, 2018

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

@luke-robertson
Copy link

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

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

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

No branches or pull requests

4 participants