From f5777006ca58a161939e762c563200296ccef9b9 Mon Sep 17 00:00:00 2001 From: Adarsh Nair Date: Thu, 22 Oct 2015 13:33:56 -0700 Subject: [PATCH 1/4] Update geocode.py --- Lesson_2/10_Requesting from Python Code/geocode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lesson_2/10_Requesting from Python Code/geocode.py b/Lesson_2/10_Requesting from Python Code/geocode.py index a023419..20a2dda 100644 --- a/Lesson_2/10_Requesting from Python Code/geocode.py +++ b/Lesson_2/10_Requesting from Python Code/geocode.py @@ -1,7 +1,7 @@ import httplib2 import json -def GetGeocodeLocation(inputString): +def getGeocodeLocation(inputString): # Use Google Maps to convert a location into Latitute/Longitute coordinates # FORMAT: https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=API_KEY # Then Store it in the DB From efb696d445b2557e40005e69ee62d5147ffb82a1 Mon Sep 17 00:00:00 2001 From: Adarsh Nair Date: Thu, 22 Oct 2015 13:39:24 -0700 Subject: [PATCH 2/4] Update geocode.py --- Lesson_2/10_Requesting from Python Code/geocode.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lesson_2/10_Requesting from Python Code/geocode.py b/Lesson_2/10_Requesting from Python Code/geocode.py index 20a2dda..96e2ca5 100644 --- a/Lesson_2/10_Requesting from Python Code/geocode.py +++ b/Lesson_2/10_Requesting from Python Code/geocode.py @@ -10,6 +10,7 @@ def getGeocodeLocation(inputString): url = ('https://maps.googleapis.com/maps/api/geocode/json?address=%s&key=%s'% (locationString, google_api_key)) h = httplib2.Http() result = json.loads(h.request(url,'GET')[1]) - latitude = result['results'][0]['geometry']['location']['lat'] - longitude = result['results'][0]['geometry']['location']['lng'] - return (latitude,longitude) + # latitude = result['results'][0]['geometry']['location']['lat'] + # longitude = result['results'][0]['geometry']['location']['lng'] + # return (latitude,longitude) + return result From 61f23db2dab53d826b83cb1e6961245f5ec1eddd Mon Sep 17 00:00:00 2001 From: Adarsh Nair Date: Thu, 22 Oct 2015 13:47:26 -0700 Subject: [PATCH 3/4] Update geocode.py --- Lesson_2/10_Requesting from Python Code/geocode.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Lesson_2/10_Requesting from Python Code/geocode.py b/Lesson_2/10_Requesting from Python Code/geocode.py index 96e2ca5..ba0cf5b 100644 --- a/Lesson_2/10_Requesting from Python Code/geocode.py +++ b/Lesson_2/10_Requesting from Python Code/geocode.py @@ -4,13 +4,11 @@ def getGeocodeLocation(inputString): # Use Google Maps to convert a location into Latitute/Longitute coordinates # FORMAT: https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=API_KEY - # Then Store it in the DB - google_api_key = "PASTE_YOUR_KEY_HERE" + google_api_key = "AIzaSyDQXlqnrnyyi1ptkZvz-X0FQDksmO-zki8" locationString = inputString.replace(" ", "+") url = ('https://maps.googleapis.com/maps/api/geocode/json?address=%s&key=%s'% (locationString, google_api_key)) h = httplib2.Http() result = json.loads(h.request(url,'GET')[1]) - # latitude = result['results'][0]['geometry']['location']['lat'] - # longitude = result['results'][0]['geometry']['location']['lng'] - # return (latitude,longitude) - return result + latitude = result['results'][0]['geometry']['location']['lat'] + longitude = result['results'][0]['geometry']['location']['lng'] + return (latitude,longitude) From a527a6aac7f1199319a32db20f7bb6737edec39c Mon Sep 17 00:00:00 2001 From: Adarsh Nair Date: Thu, 22 Oct 2015 13:48:03 -0700 Subject: [PATCH 4/4] Update geocode.py --- Lesson_2/10_Requesting from Python Code/geocode.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lesson_2/10_Requesting from Python Code/geocode.py b/Lesson_2/10_Requesting from Python Code/geocode.py index ba0cf5b..36bb39d 100644 --- a/Lesson_2/10_Requesting from Python Code/geocode.py +++ b/Lesson_2/10_Requesting from Python Code/geocode.py @@ -4,7 +4,7 @@ def getGeocodeLocation(inputString): # Use Google Maps to convert a location into Latitute/Longitute coordinates # FORMAT: https://maps.googleapis.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&key=API_KEY - google_api_key = "AIzaSyDQXlqnrnyyi1ptkZvz-X0FQDksmO-zki8" + google_api_key = "YOUR_API_KEY" locationString = inputString.replace(" ", "+") url = ('https://maps.googleapis.com/maps/api/geocode/json?address=%s&key=%s'% (locationString, google_api_key)) h = httplib2.Http()