Geoffrey Fairchild
This software is licensed under the BSD 3-Clause License. Please refer to the separate LICENSE.txt file for the exact text of the license. You are obligated to give attribution if you use this code.
yelpapi is a pure Python implementation of the Yelp v2.0 API. It is simple, fast, and robust to any changes Yelp may make to the API in the future.
This code requires Python 2.7 or higher and requests_oauthlib.
yelpapi is available on PyPI at https://pypi.python.org/pypi/yelpapi.
Install using pip:
pip install yelpapi
Install from source:
python setup.py install
This API is demonstrated more thoroughly in examples.py, but the basic idea is very simple:
from yelpapi import YelpAPI
yelp_api = YelpAPI(consumer_key, consumer_secret, token, token_secret)
search_results = yelp_api.search_query(args)
business_results = yelp_api.business_query(id=business_id, other_args)
phone_search_results = yelp_api.phone_search_query(phone=phone_number, other_args)
args
and other_args
are parameters that come directly from Yelp's Search API documentation, Business API documentation, and Phone Search API documentation. You only provide parameters you care about.
Yelp v2.0 Python implementations:
yelpapi differs from other implementations in that it is completely dynamic with respect to both the input provided by the programmer and the output provided by Yelp. Most other implementations return the results as instances of pre-defined classes, while yelpapi returns a simply-defined, dynamically-generated dict
. The benefit here is much smaller and simpler API implementation as well as preparedness for any changes Yelp may make to the API in the future.