如何解决如何通过python使用“ types”关键字从Google的Places API中过滤json数据
我已使用Python从Google的Places API中提取了json数据。我已经可以提取每个机构的名称和电话号码了。我可以针对API支持的业务类型执行此操作(例如,“ car_repair”。我希望能够提取比“ car_repair”(例如“ auto_body_shop”)更多的特定类型。当我运行以下代码时,它将从API提取指定范围内的前20个结果的名称和电话号码。问题是它们都不是汽车修理厂。
gmaps = googlemaps.Client(key = API_KEY)
places_result = gmaps.places_nearby(location= "40.35003,-111.95206",radius= 4000000,open_now= False,type= 'car_repair')
pprint.pprint(places_result)
for place in places_result['results']:
my_place_id = place['place_id']
my_fields = ['name','formatted_phone_number','type']
place_details = gmaps.place(place_id = my_place_id,fields = my_fields)
print(place_details['result']['name'],place_details['result']['formatted_phone_number'])
任何想法都有助于扩大我可以从API中提取的业务类型。想到的另一种可能性是,拉动比“ car_repair”更广泛的业务类别,并过滤json数据以仅提取我想要的类型...
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。