yelpapi 2.5.1__tar.gz → 2.7.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- yelpapi-2.7.0/.github/workflows/publish.yml +51 -0
- yelpapi-2.7.0/.github/workflows/tests.yml +49 -0
- yelpapi-2.7.0/.gitignore +25 -0
- yelpapi-2.7.0/AGENTS.md +78 -0
- yelpapi-2.7.0/CHANGES.md +85 -0
- yelpapi-2.7.0/PKG-INFO +118 -0
- yelpapi-2.7.0/README.md +64 -0
- yelpapi-2.7.0/examples/examples.py +166 -0
- yelpapi-2.7.0/pyproject.toml +65 -0
- yelpapi-2.7.0/release-notes.md +6 -0
- yelpapi-2.7.0/tests/conftest.py +14 -0
- yelpapi-2.7.0/tests/test_yelpapi.py +380 -0
- {yelpapi-2.5.1 → yelpapi-2.7.0}/yelpapi/__init__.py +2 -0
- yelpapi-2.7.0/yelpapi/py.typed +0 -0
- {yelpapi-2.5.1 → yelpapi-2.7.0}/yelpapi/yelpapi.py +156 -73
- yelpapi-2.5.1/PKG-INFO +0 -29
- yelpapi-2.5.1/README.md +0 -63
- yelpapi-2.5.1/setup.cfg +0 -4
- yelpapi-2.5.1/setup.py +0 -59
- yelpapi-2.5.1/tests/test_yelpapi.py +0 -161
- yelpapi-2.5.1/yelpapi.egg-info/PKG-INFO +0 -29
- yelpapi-2.5.1/yelpapi.egg-info/SOURCES.txt +0 -12
- yelpapi-2.5.1/yelpapi.egg-info/dependency_links.txt +0 -1
- yelpapi-2.5.1/yelpapi.egg-info/requires.txt +0 -1
- yelpapi-2.5.1/yelpapi.egg-info/top_level.txt +0 -1
- {yelpapi-2.5.1 → yelpapi-2.7.0}/AUTHORS.md +0 -0
- {yelpapi-2.5.1 → yelpapi-2.7.0}/LICENSE +0 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*'
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
environment: pypi
|
|
12
|
+
permissions:
|
|
13
|
+
id-token: write
|
|
14
|
+
contents: write
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v7
|
|
18
|
+
|
|
19
|
+
- uses: actions/setup-python@v7
|
|
20
|
+
with:
|
|
21
|
+
python-version: '3.15'
|
|
22
|
+
|
|
23
|
+
- name: Verify tag matches package version
|
|
24
|
+
run: |
|
|
25
|
+
version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
|
|
26
|
+
if [ "v${version}" != "${{ github.ref_name }}" ]; then
|
|
27
|
+
echo "Tag ${{ github.ref_name }} does not match pyproject.toml version ${version}" >&2
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
|
|
31
|
+
- name: Extract release notes from CHANGES.md
|
|
32
|
+
run: |
|
|
33
|
+
version="${GITHUB_REF_NAME#v}"
|
|
34
|
+
awk -v v="$version" '/^## /{if (f) exit; f = (index($0, "## " v " ") == 1); next} f' CHANGES.md > release-notes.md
|
|
35
|
+
if [ ! -s release-notes.md ]; then
|
|
36
|
+
echo "No CHANGES.md entry found for ${version}" >&2
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
- name: Build
|
|
41
|
+
run: |
|
|
42
|
+
pip install build
|
|
43
|
+
python -m build
|
|
44
|
+
|
|
45
|
+
- name: Publish to PyPI
|
|
46
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
47
|
+
|
|
48
|
+
- name: Create GitHub release
|
|
49
|
+
env:
|
|
50
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
51
|
+
run: gh release create "${{ github.ref_name }}" dist/* --title "YelpAPI ${{ github.ref_name }}" --notes-file release-notes.md
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
name: Tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
typecheck:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v7
|
|
16
|
+
|
|
17
|
+
# mypy targets python_version in pyproject.toml regardless of the interpreter it runs on, so a single job is
|
|
18
|
+
# sufficient. Run it on that same minimum version so installed dependencies and stubs match what users on the
|
|
19
|
+
# minimum get. Keep this equal to python_version.
|
|
20
|
+
- name: Set up Python
|
|
21
|
+
uses: actions/setup-python@v7
|
|
22
|
+
with:
|
|
23
|
+
python-version: '3.11'
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: pip install -e ".[dev]"
|
|
27
|
+
|
|
28
|
+
- name: Type-check with mypy
|
|
29
|
+
run: mypy
|
|
30
|
+
|
|
31
|
+
test:
|
|
32
|
+
runs-on: ubuntu-latest
|
|
33
|
+
strategy:
|
|
34
|
+
matrix:
|
|
35
|
+
python-version: ['3.11', '3.12', '3.13', '3.14', '3.15']
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v7
|
|
39
|
+
|
|
40
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
41
|
+
uses: actions/setup-python@v7
|
|
42
|
+
with:
|
|
43
|
+
python-version: ${{ matrix.python-version }}
|
|
44
|
+
|
|
45
|
+
- name: Install dependencies
|
|
46
|
+
run: pip install -e ".[dev]"
|
|
47
|
+
|
|
48
|
+
- name: Run tests
|
|
49
|
+
run: pytest
|
yelpapi-2.7.0/.gitignore
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.so
|
|
5
|
+
*.egg
|
|
6
|
+
*.egg-info/
|
|
7
|
+
|
|
8
|
+
# Distribution
|
|
9
|
+
build/
|
|
10
|
+
dist/
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
|
|
16
|
+
# Tools
|
|
17
|
+
.mypy_cache/
|
|
18
|
+
.ruff_cache/
|
|
19
|
+
.pytest_cache/
|
|
20
|
+
.coverage
|
|
21
|
+
htmlcov/
|
|
22
|
+
.codebase-memory/
|
|
23
|
+
|
|
24
|
+
# OS
|
|
25
|
+
.DS_Store
|
yelpapi-2.7.0/AGENTS.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to AI coding agents working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
Install dependencies:
|
|
8
|
+
```
|
|
9
|
+
pip install -e ".[dev]"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Run tests (coverage included by default via `pyproject.toml`):
|
|
13
|
+
```
|
|
14
|
+
pytest
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Run a single test:
|
|
18
|
+
```
|
|
19
|
+
pytest tests/test_yelpapi.py::TestYelpAPI::test_calls_api
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Type-check (strict; configured in `[tool.mypy]` in `pyproject.toml`, which sets the files to check and targets the minimum supported Python):
|
|
23
|
+
```
|
|
24
|
+
mypy
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
CI (`.github/workflows/tests.yml`) runs `pytest` on every supported Python version and `mypy` once in a separate `typecheck` job. Both must pass.
|
|
28
|
+
|
|
29
|
+
## Architecture
|
|
30
|
+
|
|
31
|
+
This is a thin Python wrapper around the [Yelp Fusion API](https://docs.developer.yelp.com/docs/fusion-intro). The entire implementation lives in `yelpapi/yelpapi.py` as a single `YelpAPI` class, re-exported from `yelpapi/__init__.py` via `__all__`.
|
|
32
|
+
|
|
33
|
+
**Design philosophy:** The wrapper is intentionally minimal and extensible — all API parameters are passed through `**kwargs` directly to the HTTP request, so it doesn't break when Yelp adds new parameters. The only thing that would break it is a URL scheme change. Public methods return `dict[str, Any]`; don't introduce `TypedDict`s or response models, since they would break this pass-through design.
|
|
34
|
+
|
|
35
|
+
**Request flow:** Each public method (e.g., `search_query`, `business_query`) validates required parameters, then delegates to `_query()`, which strips `None`-valued kwargs before issuing the GET request via a shared `requests.Session`. `_query()` raises `requests.HTTPError` for HTTP error statuses, and raises `YelpAPI.YelpAPIError` if the JSON body isn't an object or contains an `error` key. Methods that require a location share a `_require_location_or_lat_lng()` helper.
|
|
36
|
+
|
|
37
|
+
**Session management:** A single `requests.Session` is reused for all calls (performance benefit). Users should close it via context manager (`with YelpAPI(...) as api`) or explicitly via `api.close()`.
|
|
38
|
+
|
|
39
|
+
**Tests** use `requests-mock` (via the `mock_request` autouse fixture in `conftest.py`) to intercept HTTP calls, and `Faker` for generating random test data. No real API calls are made in tests.
|
|
40
|
+
|
|
41
|
+
## Conventions
|
|
42
|
+
|
|
43
|
+
- **Typing:** The package ships `py.typed` and must pass strict `mypy`. All library code must be fully annotated. Tests and examples are type-checked but may omit annotations; see the `[[tool.mypy.overrides]]` section of `pyproject.toml`.
|
|
44
|
+
- **Coverage:** Line coverage of `yelpapi/` is 100%. Keep it there; new code paths need tests.
|
|
45
|
+
- **Style:** Use single quotes for strings, and 120-character lines.
|
|
46
|
+
- **Adding an endpoint** requires all of the following:
|
|
47
|
+
- a `*_API_URL` constant
|
|
48
|
+
- a method that validates required parameters and calls `_query()`
|
|
49
|
+
- an entry in the `YelpAPI` class docstring's API list
|
|
50
|
+
- an entry in the README "METHODS" list
|
|
51
|
+
- tests covering both validation failures and success
|
|
52
|
+
|
|
53
|
+
## Supported Python versions
|
|
54
|
+
|
|
55
|
+
Support only Python versions that are currently maintained (not end-of-life); see https://devguide.python.org/versions/. The minimum is currently 3.11. When adding or dropping a version, update all of these together:
|
|
56
|
+
|
|
57
|
+
- `requires-python` and the `Programming Language :: Python :: 3.x` classifiers in `pyproject.toml`
|
|
58
|
+
- `python_version` in `[tool.mypy]` in `pyproject.toml` (keep it equal to the minimum)
|
|
59
|
+
- the `test` job's matrix in `.github/workflows/tests.yml`
|
|
60
|
+
- the Python version used by the `typecheck` job in `tests.yml` (keep it equal to the minimum, matching `python_version`)
|
|
61
|
+
- the Python version used by `publish.yml` (use the newest supported version)
|
|
62
|
+
- the "REQUIREMENTS" section of `README.md`
|
|
63
|
+
- `CHANGES.md`
|
|
64
|
+
|
|
65
|
+
Once the minimum is raised, newly available language and typing features (e.g., `typing.Self` with 3.11) may be used.
|
|
66
|
+
|
|
67
|
+
## Releasing
|
|
68
|
+
|
|
69
|
+
1. Bump `version` in `pyproject.toml`.
|
|
70
|
+
2. Add a `## X.Y.Z (YYYY-MM-DD)` entry at the top of `CHANGES.md`.
|
|
71
|
+
3. Commit, push, and make sure CI is green. The publish workflow does not run tests.
|
|
72
|
+
4. Push an annotated tag:
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
git tag -a vX.Y.Z -m "vX.Y.Z" && git push origin vX.Y.Z
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Pushing a `v*` tag triggers `.github/workflows/publish.yml`. Before publishing, it fails if the tag doesn't match the `pyproject.toml` version, or if `CHANGES.md` has no entry for that version. It then builds, publishes to PyPI, and creates a GitHub release whose notes are that version's `CHANGES.md` entry.
|
yelpapi-2.7.0/CHANGES.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Changes
|
|
2
|
+
|
|
3
|
+
## 2.7.0 (2026-10-28)
|
|
4
|
+
* Dropped support for end-of-life Python 3.9 and 3.10; added Python 3.15. Minimum supported version is now 3.11.
|
|
5
|
+
* `YelpAPI.__enter__` now returns `Self`, so subclasses are typed correctly when used as context managers.
|
|
6
|
+
* Declared `__all__` in the `yelpapi` package so `from yelpapi import YelpAPI` passes `mypy --strict` (no implicit re-export) and Pyright's private-import checks.
|
|
7
|
+
* Added the `Typing :: Typed` classifier.
|
|
8
|
+
* A JSON response body that isn't an object (e.g., a string or list) now raises `YelpAPI.YelpAPIError` instead of an unhelpful `TypeError` or silently returning the wrong type.
|
|
9
|
+
|
|
10
|
+
## 2.6.0 (2026-03-17)
|
|
11
|
+
* Added 5 new API endpoints: Business Engagement Metrics (`business_engagement_query`), Business Service Offerings (`business_service_offerings_query`), Categories (`categories_query`), Category by Alias (`category_query`), and Review Highlights (`review_highlights_query`).
|
|
12
|
+
* Updated all documentation URLs to the current `docs.developer.yelp.com` reference format.
|
|
13
|
+
* Migrated from `setup.py` to `pyproject.toml` (hatchling build backend).
|
|
14
|
+
* Dropped Python 3.8 support; added Python 3.13 and 3.14. Minimum supported version is now 3.9.
|
|
15
|
+
* Migrated CI from Travis CI to GitHub Actions.
|
|
16
|
+
* Added type hints throughout.
|
|
17
|
+
* Reached 100% test coverage.
|
|
18
|
+
|
|
19
|
+
## 2.5.1 (2023-10-10)
|
|
20
|
+
* Raise [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError) if one occurs (PR #25).
|
|
21
|
+
|
|
22
|
+
## 2.5.0 (2022-08-04)
|
|
23
|
+
* Implemented new `close()` method to close the `requests.Session` object we use for performant API interactions. This can also be used as a context manager (this is the preferred way).
|
|
24
|
+
* Clarified [`README.md`](README.md) to make it clear that the user should always be sure to close the connection.
|
|
25
|
+
|
|
26
|
+
## 2.4.1 (2022-08-01)
|
|
27
|
+
* Dropping EOL Python versions, adding newly-supported versions.
|
|
28
|
+
* Updating dependencies in [`requirements.txt`](requirements.txt).
|
|
29
|
+
* Updating project URL (moved from [@gfairchild](https://github.com/gfairchild)'s personal namespace to [@lanl](https://github.com/lanl)'s namespace).
|
|
30
|
+
|
|
31
|
+
## 2.4.0 (2019-04-19)
|
|
32
|
+
* `match_type` parameter for the business match endpoint was deprecated on April 1, 2019 (see [Yelp's changelog](https://www.yelp.com/developers/v3/changelog)). (courtesy @davebulaval)
|
|
33
|
+
* Added a check to ensure a required parameter, `address1`, is provided when using the business match endpoint. (courtesy @davebulaval)
|
|
34
|
+
* Support for Python versions <3.4 is removed (i.e., this no longer works with Python 2.7). This is due to some dependencies that also have abandoned Python 2 support.
|
|
35
|
+
|
|
36
|
+
## 2.3.0 (2018-07-11)
|
|
37
|
+
* Provided a means to set timeouts to API calls. (courtesy @goodspark)
|
|
38
|
+
* Added unit tests, including Travis CI automation. (courtesy @goodspark)
|
|
39
|
+
|
|
40
|
+
## 2.2.2 (2018-01-28)
|
|
41
|
+
* Add better top-level documentation for `YelpAPI`.
|
|
42
|
+
* To avoid wasting API calls on obviously invalid requests, consistently check for parameters required for requests to succeed.
|
|
43
|
+
|
|
44
|
+
## 2.2.1 (2018-01-28)
|
|
45
|
+
* Fix a few minor inconsistencies in the code.
|
|
46
|
+
|
|
47
|
+
## 2.2.0 (2018-01-28)
|
|
48
|
+
* Revised to remove token/secret access and instead use API keys. Yelp will move to API keys only in March 2018. (courtesy @tamos)
|
|
49
|
+
* An API key is now needed to instantiate a `YelpAPI` object. (courtesy @tamos)
|
|
50
|
+
* Added support for 3 new endpoints:
|
|
51
|
+
* [Event Lookup API](https://www.yelp.com/developers/documentation/v3/event)
|
|
52
|
+
* [Event Search API](https://www.yelp.com/developers/documentation/v3/event_search)
|
|
53
|
+
* [Featured Event API](https://www.yelp.com/developers/documentation/v3/featured_event)
|
|
54
|
+
* `business_match_query` no longer assumes the country is the U.S. if the country code is missing.
|
|
55
|
+
|
|
56
|
+
## 2.1.0 (2017-10-19)
|
|
57
|
+
* Implement new [Business Match API](https://www.yelp.com/developers/documentation/v3/business_match).
|
|
58
|
+
**NOTE**: This API is currently in beta. Yelp requires your app join the [Yelp Developer Beta Program](https://www.yelp.com/developers/v3/manage_app) to gain access to it.
|
|
59
|
+
|
|
60
|
+
## 2.0.1 (2017-02-27)
|
|
61
|
+
* Remove reliance on `ez_setup.py`.
|
|
62
|
+
* Add `setup.cfg` to instruct the build process to build universal wheels.
|
|
63
|
+
|
|
64
|
+
## 2.0 (2017-02-27)
|
|
65
|
+
* Implement the new Yelp Fusion API (aka Yelp v3 API). Note that yelpapi v1.4 is the last version to support the Yelp v2 API. [The Yelp v2 API is being deprecated, so all new developers should move to the new Fusion API ASAP.](https://engineeringblog.yelp.com/2017/02/recent-improvements-to-the-fusion-api.html)
|
|
66
|
+
* Use OAuth 2.0 for authentication.
|
|
67
|
+
* Implement new [Transaction Search API](https://www.yelp.com/developers/documentation/v3/transactions_search), [Reviews API](https://www.yelp.com/developers/documentation/v3/business_reviews), and [Autocomplete API](https://www.yelp.com/developers/documentation/v3/autocomplete).
|
|
68
|
+
|
|
69
|
+
## 1.4 (2016-05-10)
|
|
70
|
+
* Use HTTPS for all API calls.
|
|
71
|
+
* Use new string formatter.
|
|
72
|
+
* Remove `YelpError` since the business API now returns a JSON error when given a bad business ID.
|
|
73
|
+
|
|
74
|
+
## 1.3 (2015-05-22)
|
|
75
|
+
* Adding support for the [Phone Search API](https://www.yelp.com/developers/documentation/v2/phone_search).
|
|
76
|
+
|
|
77
|
+
## 1.2 (2013-10-08)
|
|
78
|
+
* yelpapi is now fully Python 3+ compliant.
|
|
79
|
+
|
|
80
|
+
## 1.1 (2013-10-04)
|
|
81
|
+
* Transitioning from using [python-oauth2](https://github.com/simplegeo/python-oauth2) and [requests](https://github.com/kennethreitz/requests) to just using [requests-oauthlib](https://github.com/requests/requests-oauthlib).
|
|
82
|
+
* Moving to setuptools (using [ez_setup.py](https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py) to manage it).
|
|
83
|
+
|
|
84
|
+
## 1.0 (2013-10-03)
|
|
85
|
+
* Initial release.
|
yelpapi-2.7.0/PKG-INFO
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: yelpapi
|
|
3
|
+
Version: 2.7.0
|
|
4
|
+
Summary: yelpapi is a pure Python implementation of the Yelp Fusion API.
|
|
5
|
+
Project-URL: Homepage, https://github.com/lanl/yelpapi
|
|
6
|
+
Project-URL: Changelog, https://github.com/lanl/yelpapi/blob/master/CHANGES.md
|
|
7
|
+
Author-email: Geoffrey Fairchild <mail@gfairchild.com>
|
|
8
|
+
License: Copyright (c) 2013, Triad National Security, LLC
|
|
9
|
+
All rights reserved.
|
|
10
|
+
|
|
11
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
|
12
|
+
following conditions are met:
|
|
13
|
+
|
|
14
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following
|
|
15
|
+
disclaimer.
|
|
16
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
|
|
17
|
+
following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
18
|
+
* Neither the name of Triad National Security, LLC nor the names of its contributors may be used to endorse or
|
|
19
|
+
promote products derived from this software without specific prior written permission.
|
|
20
|
+
|
|
21
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
22
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
24
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
26
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
27
|
+
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
License-File: AUTHORS.md
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
31
|
+
Classifier: Intended Audience :: Developers
|
|
32
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
33
|
+
Classifier: Operating System :: OS Independent
|
|
34
|
+
Classifier: Programming Language :: Python :: 3
|
|
35
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
41
|
+
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
|
42
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
43
|
+
Classifier: Typing :: Typed
|
|
44
|
+
Requires-Python: >=3.11
|
|
45
|
+
Requires-Dist: requests
|
|
46
|
+
Provides-Extra: dev
|
|
47
|
+
Requires-Dist: faker; extra == 'dev'
|
|
48
|
+
Requires-Dist: mypy; extra == 'dev'
|
|
49
|
+
Requires-Dist: pytest; extra == 'dev'
|
|
50
|
+
Requires-Dist: pytest-cov; extra == 'dev'
|
|
51
|
+
Requires-Dist: requests-mock; extra == 'dev'
|
|
52
|
+
Requires-Dist: types-requests; extra == 'dev'
|
|
53
|
+
Description-Content-Type: text/markdown
|
|
54
|
+
|
|
55
|
+
# yelpapi
|
|
56
|
+
|
|
57
|
+
[](https://github.com/lanl/yelpapi/actions/workflows/tests.yml)
|
|
58
|
+
|
|
59
|
+
## LICENSE
|
|
60
|
+
This software is licensed under the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause). Please refer to the separate [LICENSE](LICENSE) file for the exact text of the license. You are obligated to give attribution if you use this code.
|
|
61
|
+
|
|
62
|
+
## ABOUT
|
|
63
|
+
yelpapi is a pure Python implementation of the [Yelp Fusion API](https://docs.developer.yelp.com/docs/fusion-intro). It is simple, fast, and robust to any changes Yelp may make to the API in the future.
|
|
64
|
+
|
|
65
|
+
## REQUIREMENTS
|
|
66
|
+
This code requires Python 3.11 or higher and [requests](https://github.com/psf/requests).
|
|
67
|
+
|
|
68
|
+
## INSTALL
|
|
69
|
+
yelpapi is available on PyPI at https://pypi.org/project/yelpapi/.
|
|
70
|
+
|
|
71
|
+
Install using [pip](https://pip.pypa.io/):
|
|
72
|
+
|
|
73
|
+
pip install yelpapi
|
|
74
|
+
|
|
75
|
+
## USING THIS CODE
|
|
76
|
+
This API is demonstrated more thoroughly in [examples.py](examples/examples.py), but the following chunk of code demonstrates basic use of yelpapi:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from yelpapi import YelpAPI
|
|
80
|
+
with YelpAPI(api_key) as yelp_api:
|
|
81
|
+
search_results = yelp_api.search_query(term='ice cream', location='austin, tx')
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
You can also set timeouts so API calls do not block indefinitely in degraded network conditions:
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from yelpapi import YelpAPI
|
|
88
|
+
with YelpAPI(api_key, timeout_s=3.0) as yelp_api:
|
|
89
|
+
search_results = yelp_api.search_query(term='ice cream', location='austin, tx')
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Under the covers, this module uses a [`requests.Session`](https://requests.readthedocs.io/en/latest/user/advanced/#session-objects) object 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:
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
from yelpapi import YelpAPI
|
|
96
|
+
yelp_api = YelpAPI(api_key)
|
|
97
|
+
try:
|
|
98
|
+
search_results = yelp_api.search_query(term='ice cream', location='austin, tx')
|
|
99
|
+
finally:
|
|
100
|
+
yelp_api.close()
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## METHODS
|
|
104
|
+
* [Autocomplete API](https://docs.developer.yelp.com/reference/v3_autocomplete) - `autocomplete_query(...)`
|
|
105
|
+
* [Business API](https://docs.developer.yelp.com/reference/v3_business_info) - `business_query(...)`
|
|
106
|
+
* [Business Engagement Metrics API](https://docs.developer.yelp.com/reference/v3_get_businesses_engagement) - `business_engagement_query(...)`
|
|
107
|
+
* [Business Match API](https://docs.developer.yelp.com/reference/v3_business_match) - `business_match_query(...)`
|
|
108
|
+
* [Business Service Offerings API](https://docs.developer.yelp.com/reference/v3_business_service_offerings) - `business_service_offerings_query(...)`
|
|
109
|
+
* [Categories API](https://docs.developer.yelp.com/reference/v3_all_categories) - `categories_query(...)`
|
|
110
|
+
* [Category API](https://docs.developer.yelp.com/reference/v3_categories) - `category_query(...)`
|
|
111
|
+
* [Event Lookup API](https://docs.developer.yelp.com/reference/v3_event) - `event_lookup_query(...)`
|
|
112
|
+
* [Event Search API](https://docs.developer.yelp.com/reference/v3_events_search) - `event_search_query(...)`
|
|
113
|
+
* [Featured Event API](https://docs.developer.yelp.com/reference/v3_featured_event) - `featured_event_query(...)`
|
|
114
|
+
* [Phone Search API](https://docs.developer.yelp.com/reference/v3_business_phone_search) - `phone_search_query(...)`
|
|
115
|
+
* [Review Highlights API](https://docs.developer.yelp.com/reference/v3_business_review_highlights) - `review_highlights_query(...)`
|
|
116
|
+
* [Reviews API](https://docs.developer.yelp.com/reference/v3_business_reviews) - `reviews_query(...)`
|
|
117
|
+
* [Search API](https://docs.developer.yelp.com/reference/v3_business_search) - `search_query(...)`
|
|
118
|
+
* [Transaction Search API](https://docs.developer.yelp.com/reference/v3_transaction_search) - `transaction_search_query(...)`
|
yelpapi-2.7.0/README.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# yelpapi
|
|
2
|
+
|
|
3
|
+
[](https://github.com/lanl/yelpapi/actions/workflows/tests.yml)
|
|
4
|
+
|
|
5
|
+
## LICENSE
|
|
6
|
+
This software is licensed under the [BSD 3-Clause License](https://opensource.org/licenses/BSD-3-Clause). Please refer to the separate [LICENSE](LICENSE) file for the exact text of the license. You are obligated to give attribution if you use this code.
|
|
7
|
+
|
|
8
|
+
## ABOUT
|
|
9
|
+
yelpapi is a pure Python implementation of the [Yelp Fusion API](https://docs.developer.yelp.com/docs/fusion-intro). It is simple, fast, and robust to any changes Yelp may make to the API in the future.
|
|
10
|
+
|
|
11
|
+
## REQUIREMENTS
|
|
12
|
+
This code requires Python 3.11 or higher and [requests](https://github.com/psf/requests).
|
|
13
|
+
|
|
14
|
+
## INSTALL
|
|
15
|
+
yelpapi is available on PyPI at https://pypi.org/project/yelpapi/.
|
|
16
|
+
|
|
17
|
+
Install using [pip](https://pip.pypa.io/):
|
|
18
|
+
|
|
19
|
+
pip install yelpapi
|
|
20
|
+
|
|
21
|
+
## USING THIS CODE
|
|
22
|
+
This API is demonstrated more thoroughly in [examples.py](examples/examples.py), but the following chunk of code demonstrates basic use of yelpapi:
|
|
23
|
+
|
|
24
|
+
```python
|
|
25
|
+
from yelpapi import YelpAPI
|
|
26
|
+
with YelpAPI(api_key) as yelp_api:
|
|
27
|
+
search_results = yelp_api.search_query(term='ice cream', location='austin, tx')
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
You can also set timeouts so API calls do not block indefinitely in degraded network conditions:
|
|
31
|
+
|
|
32
|
+
```python
|
|
33
|
+
from yelpapi import YelpAPI
|
|
34
|
+
with YelpAPI(api_key, timeout_s=3.0) as yelp_api:
|
|
35
|
+
search_results = yelp_api.search_query(term='ice cream', location='austin, tx')
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Under the covers, this module uses a [`requests.Session`](https://requests.readthedocs.io/en/latest/user/advanced/#session-objects) object 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:
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from yelpapi import YelpAPI
|
|
42
|
+
yelp_api = YelpAPI(api_key)
|
|
43
|
+
try:
|
|
44
|
+
search_results = yelp_api.search_query(term='ice cream', location='austin, tx')
|
|
45
|
+
finally:
|
|
46
|
+
yelp_api.close()
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## METHODS
|
|
50
|
+
* [Autocomplete API](https://docs.developer.yelp.com/reference/v3_autocomplete) - `autocomplete_query(...)`
|
|
51
|
+
* [Business API](https://docs.developer.yelp.com/reference/v3_business_info) - `business_query(...)`
|
|
52
|
+
* [Business Engagement Metrics API](https://docs.developer.yelp.com/reference/v3_get_businesses_engagement) - `business_engagement_query(...)`
|
|
53
|
+
* [Business Match API](https://docs.developer.yelp.com/reference/v3_business_match) - `business_match_query(...)`
|
|
54
|
+
* [Business Service Offerings API](https://docs.developer.yelp.com/reference/v3_business_service_offerings) - `business_service_offerings_query(...)`
|
|
55
|
+
* [Categories API](https://docs.developer.yelp.com/reference/v3_all_categories) - `categories_query(...)`
|
|
56
|
+
* [Category API](https://docs.developer.yelp.com/reference/v3_categories) - `category_query(...)`
|
|
57
|
+
* [Event Lookup API](https://docs.developer.yelp.com/reference/v3_event) - `event_lookup_query(...)`
|
|
58
|
+
* [Event Search API](https://docs.developer.yelp.com/reference/v3_events_search) - `event_search_query(...)`
|
|
59
|
+
* [Featured Event API](https://docs.developer.yelp.com/reference/v3_featured_event) - `featured_event_query(...)`
|
|
60
|
+
* [Phone Search API](https://docs.developer.yelp.com/reference/v3_business_phone_search) - `phone_search_query(...)`
|
|
61
|
+
* [Review Highlights API](https://docs.developer.yelp.com/reference/v3_business_review_highlights) - `review_highlights_query(...)`
|
|
62
|
+
* [Reviews API](https://docs.developer.yelp.com/reference/v3_business_reviews) - `reviews_query(...)`
|
|
63
|
+
* [Search API](https://docs.developer.yelp.com/reference/v3_business_search) - `search_query(...)`
|
|
64
|
+
* [Transaction Search API](https://docs.developer.yelp.com/reference/v3_transaction_search) - `transaction_search_query(...)`
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Copyright (c) 2013, Triad National Security, LLC
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
|
|
8
|
+
following conditions are met:
|
|
9
|
+
|
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following
|
|
11
|
+
disclaimer.
|
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
|
|
13
|
+
following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
14
|
+
* Neither the name of Triad National Security, LLC nor the names of its contributors may be used to endorse or
|
|
15
|
+
promote products derived from this software without specific prior written permission.
|
|
16
|
+
|
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
18
|
+
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
20
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
21
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
22
|
+
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
23
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
# Example call:
|
|
27
|
+
# ./examples.py "[API Key]"
|
|
28
|
+
|
|
29
|
+
import argparse
|
|
30
|
+
from pprint import pprint
|
|
31
|
+
|
|
32
|
+
from yelpapi import YelpAPI
|
|
33
|
+
|
|
34
|
+
SEP = '\n-------------------------------------------------------------------------\n'
|
|
35
|
+
|
|
36
|
+
argparser = argparse.ArgumentParser(
|
|
37
|
+
description='Example Yelp queries using yelpapi. '
|
|
38
|
+
'Visit https://docs.developer.yelp.com/docs/fusion-intro to get the necessary API keys.',
|
|
39
|
+
)
|
|
40
|
+
argparser.add_argument('api_key', type=str, help='Yelp Fusion API Key')
|
|
41
|
+
args = argparser.parse_args()
|
|
42
|
+
|
|
43
|
+
with YelpAPI(args.api_key) as yelp_api:
|
|
44
|
+
# Search API: https://docs.developer.yelp.com/reference/v3_business_search
|
|
45
|
+
print("***** 5 best rated ice cream places in Austin, TX *****\nyelp_api.search_query(term='ice cream', location='austin, tx', sort_by='rating', limit=5)\n")
|
|
46
|
+
response = yelp_api.search_query(term='ice cream', location='austin, tx', sort_by='rating', limit=5)
|
|
47
|
+
pprint(response)
|
|
48
|
+
print(SEP)
|
|
49
|
+
|
|
50
|
+
# Search API (by coordinates): https://docs.developer.yelp.com/reference/v3_business_search
|
|
51
|
+
# all Yelp categories: https://docs.developer.yelp.com/docs/resources-categories
|
|
52
|
+
# centroid: https://www.flickr.com/places/info/2487956
|
|
53
|
+
print("***** 5 bike rentals in San Francisco *****\nyelp_api.search_query(categories='bikerentals', longitude=-122.4392, latitude=37.7474, limit=5)\n")
|
|
54
|
+
response = yelp_api.search_query(categories='bikerentals', longitude=-122.4392, latitude=37.7474, limit=5)
|
|
55
|
+
pprint(response)
|
|
56
|
+
print(SEP)
|
|
57
|
+
|
|
58
|
+
# Phone Search API: https://docs.developer.yelp.com/reference/v3_business_phone_search
|
|
59
|
+
print("***** search for business by phone number *****\nyelp_api.phone_search_query(phone='+13193375512')\n")
|
|
60
|
+
response = yelp_api.phone_search_query(phone='+13193375512')
|
|
61
|
+
pprint(response)
|
|
62
|
+
print(SEP)
|
|
63
|
+
|
|
64
|
+
# Business Match API: https://docs.developer.yelp.com/reference/v3_business_match
|
|
65
|
+
print("***** search for business match *****\nyelp_api.business_match_query(name='Splash Cafe', address1='197 Pomeroy Ave', city='Pismo Beach', state='CA', country='US')\n")
|
|
66
|
+
response = yelp_api.business_match_query(
|
|
67
|
+
name='Splash Cafe',
|
|
68
|
+
address1='197 Pomeroy Ave',
|
|
69
|
+
city='Pismo Beach',
|
|
70
|
+
state='CA',
|
|
71
|
+
country='US',
|
|
72
|
+
)
|
|
73
|
+
pprint(response)
|
|
74
|
+
print(SEP)
|
|
75
|
+
|
|
76
|
+
# Transaction Search API: https://docs.developer.yelp.com/reference/v3_transaction_search
|
|
77
|
+
print("***** businesses in Dallas supporting delivery transactions *****\nyelp_api.transaction_search_query(transaction_type='delivery', location='dallas, tx')\n")
|
|
78
|
+
response = yelp_api.transaction_search_query(transaction_type='delivery', location='dallas, tx')
|
|
79
|
+
pprint(response)
|
|
80
|
+
print(SEP)
|
|
81
|
+
|
|
82
|
+
# Business API: https://docs.developer.yelp.com/reference/v3_business_info
|
|
83
|
+
print("***** business information for Amy's on 6th St. *****\nyelp_api.business_query(id='amys-ice-creams-austin-3')\n")
|
|
84
|
+
response = yelp_api.business_query(id='amys-ice-creams-austin-3')
|
|
85
|
+
pprint(response)
|
|
86
|
+
print(SEP)
|
|
87
|
+
|
|
88
|
+
# Reviews API: https://docs.developer.yelp.com/reference/v3_business_reviews
|
|
89
|
+
print("***** selected reviews for Amy's on 6th St. *****\nyelp_api.reviews_query(id='amys-ice-creams-austin-3')\n")
|
|
90
|
+
response = yelp_api.reviews_query(id='amys-ice-creams-austin-3')
|
|
91
|
+
pprint(response)
|
|
92
|
+
print(SEP)
|
|
93
|
+
|
|
94
|
+
# Review Highlights API: https://docs.developer.yelp.com/reference/v3_business_review_highlights
|
|
95
|
+
# NOTE: requires a Premium Plan
|
|
96
|
+
print("***** review highlights for Amy's on 6th St. *****\nyelp_api.review_highlights_query(id='amys-ice-creams-austin-3')\n")
|
|
97
|
+
response = yelp_api.review_highlights_query(id='amys-ice-creams-austin-3')
|
|
98
|
+
pprint(response)
|
|
99
|
+
print(SEP)
|
|
100
|
+
|
|
101
|
+
# Autocomplete API: https://docs.developer.yelp.com/reference/v3_autocomplete
|
|
102
|
+
# centroid: https://www.flickr.com/places/info/2427422
|
|
103
|
+
print("***** autocomplete results for 'Hambur' in Iowa City *****\nyelp_api.autocomplete_query(text='Hambur', longitude=-91.5327, latitude=41.6560)\n")
|
|
104
|
+
response = yelp_api.autocomplete_query(text='Hambur', longitude=-91.5327, latitude=41.6560)
|
|
105
|
+
pprint(response)
|
|
106
|
+
print(SEP)
|
|
107
|
+
|
|
108
|
+
# Categories API: https://docs.developer.yelp.com/reference/v3_all_categories
|
|
109
|
+
print("***** all Yelp categories *****\nyelp_api.categories_query()\n")
|
|
110
|
+
response = yelp_api.categories_query()
|
|
111
|
+
pprint(response)
|
|
112
|
+
print(SEP)
|
|
113
|
+
|
|
114
|
+
# Category API: https://docs.developer.yelp.com/reference/v3_categories
|
|
115
|
+
print("***** details for the 'icecream' category *****\nyelp_api.category_query(alias='icecream')\n")
|
|
116
|
+
response = yelp_api.category_query(alias='icecream')
|
|
117
|
+
pprint(response)
|
|
118
|
+
print(SEP)
|
|
119
|
+
|
|
120
|
+
# Event Search API: https://docs.developer.yelp.com/reference/v3_events_search
|
|
121
|
+
print("***** event search result *****\nyelp_api.event_search_query()\n")
|
|
122
|
+
response = yelp_api.event_search_query()
|
|
123
|
+
pprint(response)
|
|
124
|
+
print(SEP)
|
|
125
|
+
|
|
126
|
+
# Event Lookup API: https://docs.developer.yelp.com/reference/v3_event
|
|
127
|
+
print("***** event lookup result using previous search's first event *****\nyelp_api.event_lookup_query(id=response['events'][0]['id'])\n")
|
|
128
|
+
response = yelp_api.event_lookup_query(id=response['events'][0]['id'])
|
|
129
|
+
pprint(response)
|
|
130
|
+
print(SEP)
|
|
131
|
+
|
|
132
|
+
# Featured Event API: https://docs.developer.yelp.com/reference/v3_featured_event
|
|
133
|
+
print("***** featured event lookup result for New York City, NY *****\nyelp_api.featured_event_query(location='New York City, NY')\n")
|
|
134
|
+
response = yelp_api.featured_event_query(location='New York City, NY')
|
|
135
|
+
pprint(response)
|
|
136
|
+
print(SEP)
|
|
137
|
+
|
|
138
|
+
# Business Engagement Metrics API: https://docs.developer.yelp.com/reference/v3_get_businesses_engagement
|
|
139
|
+
# NOTE: requires special permissions on the Yelp Places API key
|
|
140
|
+
print("***** engagement metrics for Amy's on 6th St. *****\nyelp_api.business_engagement_query(business_ids='amys-ice-creams-austin-3')\n")
|
|
141
|
+
response = yelp_api.business_engagement_query(business_ids='amys-ice-creams-austin-3')
|
|
142
|
+
pprint(response)
|
|
143
|
+
print(SEP)
|
|
144
|
+
|
|
145
|
+
# Business Service Offerings API: https://docs.developer.yelp.com/reference/v3_business_service_offerings
|
|
146
|
+
# NOTE: requires special permissions on the Yelp Places API key
|
|
147
|
+
print("***** service offerings for Amy's on 6th St. *****\nyelp_api.business_service_offerings_query(id='amys-ice-creams-austin-3')\n")
|
|
148
|
+
response = yelp_api.business_service_offerings_query(id='amys-ice-creams-austin-3')
|
|
149
|
+
pprint(response)
|
|
150
|
+
print(SEP)
|
|
151
|
+
|
|
152
|
+
# Example erroneous search query
|
|
153
|
+
print("***** sample erroneous search query *****\nyelp_api.search_query(term='ice cream', location='austin, tx', sort_by='BAD_SORT')\n")
|
|
154
|
+
try:
|
|
155
|
+
# sort can only take on values "best_match", "rating", "review_count", or "distance"
|
|
156
|
+
yelp_api.search_query(term='ice cream', location='austin, tx', sort_by='BAD_SORT')
|
|
157
|
+
except YelpAPI.YelpAPIError as e:
|
|
158
|
+
print(e)
|
|
159
|
+
print(SEP)
|
|
160
|
+
|
|
161
|
+
# Example erroneous business query
|
|
162
|
+
print("***** sample erroneous business query *****\nyelp_api.business_query(id='fake-business')\n")
|
|
163
|
+
try:
|
|
164
|
+
yelp_api.business_query(id='fake-business')
|
|
165
|
+
except YelpAPI.YelpAPIError as e:
|
|
166
|
+
print(e)
|