Where do I find the Google Places API Client Library for Python? -
it's not under supported libraries here: https://developers.google.com/api-client-library/python/reference/supported_apis
is not available python? if not, language available for?
andre's answer points @ correct place reference api. since question python specific, allow me show basic approach building submitted search url in python. example way search content in few minutes after sign google's free api key.
access_token = <get 1 of these following directions on places page> import urllib def build_url(search_text='',types_text=''): base_url = 'https://maps.googleapis.com/maps/api/place/textsearch/json' # can change json xml change output type key_string = '?key='+access_token # first think after base_url starts ? instead of & query_string = '&query='+urllib.quote(search_text) sensor_string = '&sensor=false' # presumably not getting location device gps type_string = '' if types_text!='': type_string = '&types='+urllib.quote(types_text) # more on types: https://developers.google.com/places/documentation/supported_types url = base_url+key_string+query_string+sensor_string+type_string return url print(build_url(search_text='your search string here'))
this code build , print url searching whatever put in last line replacing "your search string here". need build 1 of urls each search. in case i've printed can copy , paste browser address bar, give return (in browser) of json text object same when program submits url. recommend using python requests library within program , can taking returned url , doing this:
response = requests.get(url)
next need parse returned response json, can converting json library (look json.loads example). after running response through json.loads have nice python dictionary results. can paste return (e.g. browser or saved file) online json viewer understand structure while write code access dictionary comes out of json.loads.
please feel free post more questions if part of isn't clear.
Comments
Post a Comment