diff --git a/geocoders/google.py b/geocoders/google.py index 00e902b..9221b3a 100644 --- a/geocoders/google.py +++ b/geocoders/google.py @@ -3,11 +3,15 @@ # https://developers.google.com/maps/documentation/geocoding/ +#update:google apply no policy in using geocoding api, including 'https' instead of 'http',2500 requests/day. +#you can apply google api key in website https://console.developers.google.com after creating project, then turn on the service "Geocoding API" and create new key for browser application in "Credentials". +#you can then test your google api key in browser like this:https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=new york&key=AIzaSyCTiFJreqzvYieWdH555m--bVnO70qeJ4E def geocode(q, api_key=None): json = simplejson.load(urllib.urlopen( - 'http://maps.googleapis.com/maps/api/geocode/json?' + urllib.urlencode({ + 'https://maps.googleapis.com/maps/api/geocode/json?' + urllib.urlencode({ 'address': q, + 'key':api_key, 'sensor': 'false', }) ))