facepy icon indicating copy to clipboard operation
facepy copied to clipboard

__paging_token query parameter broken

Open cdchan opened this issue 10 years ago • 4 comments

__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 https://github.com/jgorset/facepy/issues/99) because using the until parameter is not enough.

The string replacement was introduced in https://github.com/jgorset/facepy/pull/94. I'm not familiar with fb:explicitly_shared so I'm not sure what the correct change is here.

cdchan avatar Jan 09 '15 17:01 cdchan

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?

jgorset avatar Jan 18 '15 10:01 jgorset

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?

cdchan avatar Jan 20 '15 15:01 cdchan

Bump.

atran avatar Jul 13 '15 18:07 atran

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 avatar Aug 02 '20 18:08 jgorset