slimkrazy / python-google-places

Simple wrapper around the new 'experimental' Google Places API
MIT License
474 stars 167 forks source link

20 result only #73

Closed nepthys closed 7 years ago

nepthys commented 8 years ago

The script returns 20 result only. How to get all results?

wroberts commented 8 years ago

+1

nepthys commented 8 years ago

wroberts, I was mistaken, that's why I didn't get any answer. The code returns 20 results (all results for the page 1) but you can use the value "query_result.next_page_key" obtain 60 results (results for the pages 2 and 3).

After your firect query, just check if the next page exists. If so, you can execute another query:

if query_result.next_page_key: time.sleep(2)#wait to avoid error query_result = google_places.nearby_search(next_page_token=query_result.next_page_key )

karthikapp commented 8 years ago

Hi the above code doesn't seem to work. I get the following error AttributeError: 'GooglePlacesSearchResult' object has no attribute 'next_page_key'

slimkrazy commented 7 years ago

This feature has been released in version 1.4.0. Please check the README for usage.