import the yelpapi module (a final dependency)
[yelp-api-cdsw] / docs / yelpapi-README.md
1 # yelpapi
2
3 ## AUTHOR
4 Geoffrey Fairchild
5 * [http://www.gfairchild.com/](http://www.gfairchild.com/)
6 * [https://github.com/gfairchild](https://github.com/gfairchild)
7 * [http://www.linkedin.com/in/gfairchild/](http://www.linkedin.com/in/gfairchild/)
8
9 ## LICENSE
10 This software is licensed under the [BSD 3-Clause License](http://opensource.org/licenses/BSD-3-Clause). Please refer to the separate [LICENSE.txt](LICENSE.txt) file for the exact text of the license. You are obligated to give attribution if you use this code.
11
12 ## ABOUT
13 yelpapi is a pure Python implementation of the [Yelp v2.0 API](http://www.yelp.com/developers/documentation/v2/overview). It is simple, fast, and robust to any changes Yelp may make to the API in the future.
14
15 ## REQUIREMENTS
16 This code requires Python 2.7 or higher and [requests_oauthlib](https://github.com/requests/requests-oauthlib).
17
18 ## INSTALL
19 yelpapi is available on PyPI at https://pypi.python.org/pypi/yelpapi.
20
21 Install using [pip](http://www.pip-installer.org/):
22
23     pip install yelpapi
24
25 Install from source:
26
27     python setup.py install
28
29 ## USING THIS CODE
30 This API is demonstrated more thoroughly in [examples.py](examples/examples.py), but the basic idea is very simple:
31
32 ```python
33 from yelpapi import YelpAPI
34 yelp_api = YelpAPI(consumer_key, consumer_secret, token, token_secret)
35 search_results = yelp_api.search_query(args)
36 business_results = yelp_api.business_query(id=business_id, other_args)
37 ```
38
39 `args` and `other_args` are parameters that come directly from Yelp's [Search API documentation](http://www.yelp.com/developers/documentation/v2/search_api) and [Business API documentation](http://www.yelp.com/developers/documentation/v2/business). You only provide parameters you care about.
40
41 ## DIFFERENCES
42 Yelp v2.0 Python implementations:
43
44 * [Official Yelp GitHub repo](https://github.com/Yelp/yelp-api/tree/master/v2/python)
45 * [python-yelp](https://github.com/adamhadani/python-yelp)
46 * [python-yelp-v2](https://github.com/mathisonian/python-yelp-v2)
47
48 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.

Benjamin Mako Hill || Want to submit a patch?