Skip to content
/ yelpapi Public

yelpapi is a pure Python implementation of the Yelp Fusion API (aka Yelp v3 API).

License

Notifications You must be signed in to change notification settings

lanl/yelpapi

Repository files navigation

yelpapi

Build Status

LICENSE

This software is licensed under theBSD 3-Clause License.Please refer to the separateLICENSEfile for the exact text of the license. You are obligated to give attribution if you use this code.

ABOUT

yelpapi is a pure Python implementation of theYelp Fusion API.It is simple, fast, and robust to any changes Yelp may make to the API in the future.

REQUIREMENTS

This code requires Python 3.8 or higher andrequests.

INSTALL

yelpapi is available on PyPI athttps://pypi.org/project/yelpapi/.

Install usingpip:

pip install yelpapi

Install from source:

Python setup.py install

USING THIS CODE

This API is demonstrated more thoroughly inexamples.py,but the following chunk of code demonstrates basic use of yelpapi:

fromyelpapiimportYelpAPI
withYelpAPI(api_key)asyelp_api:
search_results=yelp_api.search_query(args)

You can also set timeouts so API calls do not block indefinitely in degraded network conditions:

fromyelpapiimportYelpAPI
withYelpAPI(api_key,timeout_s=3.0)asyelp_api:
search_results=yelp_api.search_query(args)

Under the covers, this module uses arequests.Sessionobject for issuing all API calls, which offers potentially significant performance benefits over issuing separate API calls outside of a session. You should be sure to close the underlying session when all API interactions are complete. The above examples demonstrate using the class as a context manager, which will automatically close the connection when you're done and is the preferred way of using the class, but you can also manually close it like this if a context manager won't work for your use case:

fromyelpapiimportYelpAPI
try:
yelp_api=YelpAPI(api_key)
search_results=yelp_api.search_query(args)
finally:
yelp_api.close()

METHODS

About

yelpapi is a pure Python implementation of the Yelp Fusion API (aka Yelp v3 API).

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages