mediapop / django-friendface

Getting Facebook to work for Django.
2 stars 0 forks source link

Implement a ResultsQueryset that lets us iterate over the Facebook graph. #39

Open kitsunde opened 11 years ago

kitsunde commented 11 years ago

Currently when we make a request we get back a dict, so if we encounter the case where we have multiple pages of data to go over we would need to construct our next request in whatever method that was using request.

If we instead implement a ResultsQueryset that fired the next request as needed we could do:

for person in user.request('/me/friends'):
    # Do stuff with 1000 friends.

Rather than having to do something like this right now:

result = user.request('/me/friends')
people = result['data']
# pseudocode is python
while(result['next_url']):
    result = user.request(result['next_url'])
    people.extend(result['data'])
kitsunde commented 11 years ago

Assuming we do, this would also open up for the possibility of abstracting away things similar to the Django ORM like specifying which fields you want back, like:

user.request('/me/friends').only('birthday', 'name')

Which should be a separate ticket if we end up doing that