google maps find_place()位置参数问题

2024-10-01 09:21:14 发布

您现在位置:Python中文网/ 问答频道 /正文

我需要在一个项目中使用googlemaps/googlemaps服务python,但是存在问题。在

我想使用find_place():

def find_place(client, input, input_type, fields=None, location_bias=None,
                language=None):

但当我启动脚本时

^{pr2}$

有一个问题:


Traceback (most recent call last):
  File "gpbapp/program/place.py", line 15, in <module>
    loca = place.gmaps.find_place(place.key,place.words[0],"textquery",['place_id','formatted_address'])
  File "C:\Users\krfou\Documents\OPENCLASSROOMS\p7\env\lib\site-packages\googlemaps\client.py", line 365, in wrapper
    result = func(*args, **kwargs)
  File "C:\Users\krfou\Documents\OPENCLASSROOMS\p7\env\lib\site-packages\googlemaps\places.py", line 94, in find_place
    "the given value is invalid: '%s'" % input_type)
ValueError: Valid values for the `input_type` param for `find_place` are 'textquery' or 'phonenumber', the given value is invalid: 'disneyland, paris'
(env)

如果我这么做

loca = place.gmaps.find_place(place.key,"textquery",['place_id','formatted_address'])

它工作了,但我没有结果(因为输入已经不存在了)。在

{'candidates': [], 'status': 'ZERO_RESULTS'}

位置参数之间存在混淆,好像有一个隐藏的参数。。。会发生什么?在


Tags: theinpyenvclientnoneinputtype
1条回答
网友
1楼 · 发布于 2024-10-01 09:21:14

如果你这样做了,它不管用吗

loca = place.gmaps.find_place(client=place.key,input="place to find", input_type="textquery",fields=['place_id','formatted_address'])

相关问题 更多 >