I am using the geocoder package in Python to obtain the coordinates for a set of addresses (around 30k). I get the following error:
Status code Unknown from https://maps.googleapis.com/maps/api/geocode/json: ERROR - HTTPSConnectionPool(host='maps.googleapis.com', port=443): Max retries exceeded with url: /maps/api/geocode/json?address=Rancho+Palos+Verdes%2CCA%2CUS&bounds=&components=®ion=&language= (Caused by ProxyError('Cannot connect to proxy.', timeout('timed out',)))
The number of times I receive the error reduces if I add the time.sleep(x) function but it significantly increases the time taken to execute the code. Is there a more efficient way to run the code?
Following is a snippet of the code:
for add in clean_address: g=geocoder.google(add) time.sleep(7) if(g.ok==True): lat.append(str(g.lat)) lon.append(str(g.lng)) if(g.ok==False): lat.append("") lon.append("")