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

__paging_token query parameter broken #126

Open
cdchan opened this issue Jan 9, 2015 · 4 comments
Open

__paging_token query parameter broken #126

cdchan opened this issue Jan 9, 2015 · 4 comments
Labels
Facebook bug A bug in Facebook's API

Comments

@cdchan
Copy link
Contributor

cdchan commented Jan 9, 2015

__paging_token is a parameter used to page through feeds

However, because of https://github.com/jgorset/facepy/blob/master/facepy/graph_api.py#L235, the __ is replaced with : and Facebook ignores the parameter.

This can lead to infinite paging (similar to #99) because using the until parameter is not enough.

The string replacement was introduced in #94. I'm not familiar with fb:explicitly_shared so I'm not sure what the correct change is here.

@jgorset
Copy link
Owner

jgorset commented Jan 18, 2015

Nice catch, @cdchan! That explains #99.

This could be tricky, though. I think we have two options here:

1: Use something other than double underscores to represent a colon that is also a valid argument name in Python (like, I don't know, fb_colon_explicitly_shared).

2: Keep a map of parameters that can't be typed out as an argument in Python and convert them (e.g. from fb_explicitly_shared to fb:explicitly_shared).

I think option 1 is least ideal, as it would be backwards incompatible all the way back to 0.9.0. Option 2 breaks with our idea of being a dumb client so as to just work with any new Graph API endpoint or parameters. To my knowledge fb:explicitly_shared is the only parameter that we'd need to consider, though, and I don't think hope Facebook will make a habit of it.

What do you think?

@cdchan
Copy link
Contributor Author

cdchan commented Jan 20, 2015

I don't use facepy's paging, so I wasn't sure if it explains #99 or not. (I have my own paging setup which is how I discovered __paging_token.)

But I'm actually a little confused about how paging works in https://github.com/jgorset/facepy/blob/master/facepy/graph_api.py#L291

From what I've seen result['paging']['next'] is a url with all the query parameters in it, so does it double up on the parameters when it hits https://github.com/jgorset/facepy/blob/master/facepy/graph_api.py#L248 as it pages?

Since https://github.com/jgorset/facepy/blob/master/facepy/graph_api.py#L236 only happens once it seems like it wouldn't actually affect paginate.

Anyway, doesn't having to specify fb__explicitly_shared when using _query already violates the dumb client idea in part?

@atran
Copy link

atran commented Jul 13, 2015

Bump.

@jgorset
Copy link
Owner

jgorset commented Aug 2, 2020

Seems like this is actually a bug in Facebook's API now. At least in my Graph API Explorer, this query keeps going with next forever:

search?pretty=0&q=coffee&type=place&center=59.913%2C10.752&distance=1000&limit=50&after=MzQ5

@jgorset jgorset added Facebook bug A bug in Facebook's API and removed Bug A bug in Facepy labels Aug 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Facebook bug A bug in Facebook's API
Projects
None yet
Development

No branches or pull requests

3 participants