我正在尝试使用Google地图服务的Python客户端来使用Places API提取地点列表.
这是GitHub页面:https://github.com/googlemaps/google-maps-services-python 这是文档页面:https://googlemaps.github.io/google-maps-services-python/docs/2.4 0.4 /#模块googlemaps.exceptions
在.places def中,我需要以字符串格式输入page_token以获得下一个10个列表.当我运行下面的代码时,它一直显示INVALID_REQUEST
这是我的代码:
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'])
Run Code Online (Sandbox Code Playgroud)