How to get coordinates of address from Python

I would strongly recommend to use geopy. It will return the latitude and longitude, you can use it in the Google JS client afterwards.

>>> from geopy.geocoders import Nominatim
>>> geolocator = Nominatim()
>>> location = geolocator.geocode("175 5th Avenue NYC")
>>> print(location.address)
Flatiron Building, 175, 5th Avenue, Flatiron, New York, NYC, New York, ...
>>> print((location.latitude, location.longitude))
(40.7410861, -73.9896297241625)

Additionally you can specifically define you want to use Google services by using GoogleV3 class as a geolocator

>>> from geopy.geocoders import GoogleV3
>>> geolocator = GoogleV3()

I would suggest using Py-Googlemaps. To use it is easy:

from googlemaps import GoogleMaps
gmaps = GoogleMaps(API_KEY)
lat, lng = gmaps.address_to_latlng(address)

EDIT: If necessary, install Py-Googlemaps via: sudo easy_install googlemaps.


Google Data has an API for Maps has a REST-ful API - and they also have a Python library built around it already.