Generic where-to-buy CLI for inspecting product pages or direct product identifiers and returning retailer and store availability.
python3 -m pip install -e .
wtb --helpThe CLI reads its site configuration from environment variables:
WTB_HOSTWTB_PATH_PREFIXWTB_LANGWTB_COUNTRYWTB_APP_IDWTB_WTBIDWTB_ALLOWED_HOSTSfor an optional comma-separated allowlist
See .env.example for a minimal template.
From a product page:
wtb lookup \
--url "https://example.com/products/example-product" \
--zip 10001 \
--format jsonFrom a direct identifier:
wtb lookup --ean 35000979087 --zip 10001 --format jsonUseful overrides:
--app-idoverrides the configured app id--wtbidoverrides the configured widget id--latand--lngcan be used instead of ZIP when you already have coordinates
wtb diag config --format jsonThis command fetches the configured app and widget metadata, which is useful when you are validating a new site config or a fresh environment.
JSON output is grouped into:
metafor product, location, config, and pagination informationonlinefor retailer entriesin_storefor physical store entries
The text formatter prints a short summary of product name, GTIN, and result counts.
JSON command failures write an error.type and error.message object to stderr. URL-bearing third-party fields are filtered to http and https targets where possible and marked with source: "third_party" plus trusted: false.
Do not treat retailer availability, price, inventory, or cart handoff URLs as guaranteed. They come from third-party where-to-buy data and can differ from the live retailer site.
python3 -m unittest discover -s tests -vSet WTB_LIVE=1 to enable the optional live smoke scaffold in the test suite.
When this CLI is wrapped by another tool, keep the request simple:
- one product URL or one EAN/GTIN
- one location input
- optional
--app-idor--wtbidoverrides only when the default config needs to be replaced