ignore the __pychache__ directory
[yelp-api-cdsw] / yelp1.py
1 from yelpapi import YelpAPI
2 from yelp_authentication import CONSUMER_KEY, CONSUMER_SECRET, TOKEN, TOKEN_SECRET
3
4 yelp_api = YelpAPI(CONSUMER_KEY, CONSUMER_SECRET, TOKEN, TOKEN_SECRET)
5
6 # Example search by location text and term. Take a look at
7 # http://www.yelp.com/developers/documentation/v2/search_api for
8 # the various options available.
9
10 print('***** 5 best rated ice cream places in Austin, TX *****')
11
12 response = yelp_api.search_query(term='ice cream', location='austin, tx', sort=2, limit=5)
13
14 print('region center (lat,long): %s,%s\n' % (response['region']['center']['latitude'], response['region']['center']['longitude']))
15
16 for business in response['businesses']:
17     print('%s\n\tYelp ID: %s\n\trating: %g (%d reviews)\n\taddress: %s' % (business['name'], business['id'], business['rating'], business['review_count'], ', '.join(business['location']['display_address'])))
18

Benjamin Mako Hill || Want to submit a patch?