I'm using Google Maps APi places search in python
import urllib
import urllib.request
import json
googleGeocodeUrl = 'https://maps.googleapis.com/maps/api/place/textsearch/json?query='
keyword = "hospitales"
geolocation = "&location=-12.135,-77.023&radius=5000"
APIKEY = '&key='+'AIzaSyg5v17Ik'
url = googleGeocodeUrl + keyword + geolocation + APIKEY
print(url)
url = googleGeocodeUrl + keyword + geolocation + APIKEY
json_response = urllib.request.urlopen(url)
search = json_response.read().decode('utf-8')
searchjson = json.loads(search)
export = open('hopital.csv','w')
for place in searchjson['results']:
print(place['name'])
print(place['geometry']['location'])
export.write(place['name']+','+str(place['geometry']['location']['lng'])\
+','+str(place['geometry']['location']['lat'])+'\n')
export.close()
I want my code to make some kind of loop where it's gonna return results for more than one geographic coordinate at the time. How can I achieve that? Any code sample that could help me?