awacke1 commited on
Commit
28dd4a5
·
1 Parent(s): 295c6ab

Create app.py

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