我正在尝试使用Places API获取一个城市中餐馆的列表。我经常会遇到这样的错误:
Traceback (most recent call last):
File "googlePlacesAPI.py", line 10, in <module>
radius=20000, types=[types.TYPE_FOOD])
File "/Users/**me**/Downloads/slimkrazy-python-google-places-d4b7363/googleplaces/__init__.py", line 281, in nearby_search
lat_lng_str = self._generate_lat_lng_string(lat_lng, location)
File "/Users/**me**/Downloads/slimkrazy-python-google-places-d4b7363/googleplaces/__init__.py", line 593, in _generate_lat_lng_string
'lat_lng must be a dict with the keys, \'lat\' and \'lng\'. Cause: %s' % str(e))
ValueError: lat_lng must be a dict with the keys, 'lat' and 'lng'. Cause: Request to URL https://maps.googleapis.com/maps/api/geocode/json?sensor=false&key=YOUR_API_KEY&address=%7B%27lat%27%3A+%2733.7490%27%2C+%27lng%27%3A+%2784.3880%27%7D failed with response code: REQUEST_DENIED
我相信这是由于我的API键不起作用,尽管在Google开发人员控制台中启用了它。我会错过什么?你知道吗
ValueError:lat\u lng必须是带有键“lat”和“lng”的dict。
原因: 请求到URL
因此,对象必须是{key:value,key:value}格式,并且您的URL必须具有有效的API键。您需要用实际的API键替换
key=YOUR_API_KEY
。你知道吗相关问题 更多 >
编程相关推荐