Last active
December 7, 2019 08:29
-
-
Save PattyAppier/d335be50c761ea5914806fd1104689ff to your computer and use it in GitHub Desktop.
PattysGooPy.proj_2018_601
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyrebase | |
import GooPy | |
import pyrebase | |
config = { | |
"apiKey": "AIzaSyClr4KhSkUVy0kMipcXCYMCMpDCFgBEXKY", | |
"authDomain": "pattys-goopy-1527579295440.firebaseapp.com", | |
"databaseURL": "https://pattys-goopy-1527579295440.firebaseio.com", | |
"storageBucket": "pattys-goopy-1527579295440.appspot.com", | |
"messagingSenderId": "557738520788" | |
} | |
firebase = pyrebase.initialize_app(config) | |
db = firebase.database() | |
db.child("users").child("Pattys Lab") | |
data = {"distance":GooPy.distances} | |
db.child("How far now").push(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.request | |
import json | |
import ssl | |
import googleapiclient | |
endpoint = 'https://maps.googleapis.com/maps/api/distancematrix/json?' | |
ssl._create_default_https_context = ssl._create_unverified_context | |
api_key = 'AIzaSyC14nJwhxNKsRtDWZNZzM_vCu0D4imEwBs' | |
origin = input('where are you?: ').replace('','+') | |
destination = input('where do you want to go?: ').replace('','+') | |
mode = input('what kind of transportation tool you are using?:') | |
nav_request = 'origins={}&destinations={}&key={}'.format(origin, destination, api_key) | |
request = endpoint + nav_request | |
response = urllib.request.urlopen(request).read() # url String | |
distances = json.loads(response) # | |
print(distances) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment