-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbusiness_search.py
48 lines (32 loc) · 919 Bytes
/
business_search.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from yelp.client import Client
from yelp.oauth1_authenticator import Oauth1Authenticator
auth = Oauth1Authenticator(
consumer_key="04-oPqIVQE085yKYHNpn9Q",
consumer_secret="4bRs-oBARaBFfQdAWgjTdhdJXPU",
token="ec7SmRYyo8kAR6wNgeHwOTvITzC1jYAi",
token_secret="Uu9qBWo7olB6lmp2nsQ9g0xHSPE"
)
client = Client(auth)
#look for Montreal restaurants
#english reviews
params = {
'term': 'restaurants',
'lang': 'en'
}
response = client.search('Montreal', **params)
#get their ID
####response.businesses[0].id
print(response.businesses[0].id)
str1 = str(response.businesses[0].id)
#get reviews for this business-id
params_b = {
'lang' : 'en'
}
response_b = client.get_business(str1, **params)
#print(response_b.reviews)
'''
response = client.get_business('yelp-san-francisco', **params)
print(response)
print(response.business.name)
print(response.business.categories)
'''