I'm trying out Python Client for Google Maps Services to pull a list of places using Places API.
Here is the GitHub page: https://github.com/googlemaps/google-maps-services-python Here is the documentation page: https://googlemaps.github.io/google-maps-services-python/docs/2.4.4/#module-googlemaps.exceptions
In the .places def, I need to enter page_token in string format in order to get next 10 listings. When I run the codes below, it kept showing me INVALID_REQUEST
Here is my code:
places_result = gmaps.places(query="hotels in Singapore", page_token='')
for result in places_result['results']:
print(result['name'])
try :
places_result = gmaps.places(query="hotels in Singapore", page_token=places_result['next_page_token'])
except ApiError as e:
print(e)
else:
for result in places_result['results']:
print(result['name'])