1pip install googlemaps
2
3import googlemaps
4from datetime import datetime
5
6gmaps = googlemaps.Client(key='Add Your Key here')
7
8# Geocoding an address
9geocode_result = gmaps.geocode('1600 Amphitheatre Parkway, Mountain View, CA')
10
11# Look up an address with reverse geocoding
12reverse_geocode_result = gmaps.reverse_geocode((40.714224, -73.961452))
13
14# Request directions via public transit
15now = datetime.now()
16directions_result = gmaps.directions("Sydney Town Hall",
17 "Parramatta, NSW",
18 mode="transit",
19 departure_time=now)