X-Git-Url: https://projects.mako.cc/source/yelp-api-cdsw/blobdiff_plain/780a521a94cb490636e3cd296b9ce339db1517bc..5632f1d30d231449e6174f3f9860cda6ab5ae4d2:/yelp2.py diff --git a/yelp2.py b/yelp2.py new file mode 100644 index 0000000..ff55338 --- /dev/null +++ b/yelp2.py @@ -0,0 +1,18 @@ +from yelpapi import YelpAPI +from yelp_authentication import CONSUMER_KEY, CONSUMER_SECRET, TOKEN, TOKEN_SECRET + +yelp_api = YelpAPI(CONSUMER_KEY, CONSUMER_SECRET, TOKEN, TOKEN_SECRET) + +# Example search by bounding box and category. See +# http://www.yelp.com/developers/documentation/v2/all_category_list +# for an official list of Yelp categories. The bounding box definition +# comes from +# http://isithackday.com/geoplanet-explorer/index.php?woeid=12587707. + +print('***** 5 bike rentals in San Francisco county *****') + +response = yelp_api.search_query(category_filter='bikerentals', bounds='37.678799,-123.125740|37.832371,-122.356979', limit=5) + +for business in response['businesses']: + 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'])))