-
Notifications
You must be signed in to change notification settings - Fork 0
/
gmaps.py
executable file
·26 lines (20 loc) · 1.01 KB
/
gmaps.py
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
#!/usr/local/bin/python3
import googlemaps
from datetime import datetime
gmaps = googlemaps.Client(key='AIzaSyDWfgw7VvZqrMW0neLvY0e7u5qOgxZL6uY')
# 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)
print (addressvalidation_result)