-
Notifications
You must be signed in to change notification settings - Fork 0
/
nearby.py
28 lines (28 loc) · 1.04 KB
/
nearby.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
27
28
import requests
import json
import pyrebase
import webbrowser
class Nearby:
def Place(string):
config = {
"apiKey": "AIzaSyAr_BoRAS-SxWZ4IMPaW_YfxiQB5MiGXO8",
"authDomain": "hack36-app-module-2019-jan.firebaseapp.com",
"databaseURL": "https://hack36-app-module-2019-jan.firebaseio.com/",
"storageBucket": "hack36-app-module-2019-jan.appspot.com"
}
firebase = pyrebase.initialize_app(config)
db = firebase.database()
latitude= db.child("latitude").get();
latitude=latitude.val();
longitude=db.child("longitude").get();
longitude=longitude.val();
url="https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="+str(latitude)+","+str(longitude)+"&radius=2500&types="+string+"&sensor=true&key=AIzaSyBvN7-4PKDpvpcw-dkTd_6-B5WuptirDSw"
results=requests.get(url).json();
res=results["results"]
string="";
for result in res:
#print(result["name"])
#print(result["user_ratings_total"])
#print(result["vicinity"])
string="name:::"+result["name"]+"\n"+"Address::"+result["vicinity"]+"\n\n"+string;
return string;