File size: 1,053 Bytes
28dd4a5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import googlemaps
import os
#GM_TOKEN=os.environ.get("GM_TOKEN") # Get Google Maps Token Here:
from datetime import datetime
gmaps = googlemaps.Client(key='AIzaSyBmXtWYC0vltFMSDZmmPI0VpyHiRCnZ1_8')
# Geocoding an address
geocode_result = gmaps.geocode('1600 Amphitheatre Parkway, Mountain View, CA')
# Look up an address with reverse geocoding
reverse_geocode_result = gmaps.reverse_geocode((40.714224, -73.961452))
# Request directions via public transit
now = datetime.now()
directions_result = gmaps.directions("Sydney Town Hall",
"Parramatta, NSW",
mode="transit",
departure_time=now)
# Validate an address with address validation
addressvalidation_result = gmaps.addressvalidation(['1600 Amphitheatre Pk'],
regionCode='US',
locality='Mountain View',
enableUspsCass=True) |