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
USING THIS CODE
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)
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 (the entire implementation is only 107 lines, including comments and whitespace!) as well as preparedness for any changes Yelp may make to the API in the future.