From b028cbf1ade51cabc8b500c19c0309e7b910a35d Mon Sep 17 00:00:00 2001 From: zuijiawoniu Date: Tue, 29 Jul 2014 21:21:45 +0800 Subject: [PATCH] Update google.py using 'https' instead of 'http' in Geocoding API requests. --- geocoders/google.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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', }) ))