Skip to content

li4520/wtb-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wtb-cli

Generic where-to-buy CLI for inspecting product pages or direct product identifiers and returning retailer and store availability.

Install

python3 -m pip install -e .
wtb --help

Configuration

The CLI reads its site configuration from environment variables:

  • WTB_HOST
  • WTB_PATH_PREFIX
  • WTB_LANG
  • WTB_COUNTRY
  • WTB_APP_ID
  • WTB_WTBID
  • WTB_ALLOWED_HOSTS for an optional comma-separated allowlist

See .env.example for a minimal template.

Lookup

From a product page:

wtb lookup \
  --url "https://example.com/products/example-product" \
  --zip 10001 \
  --format json

From a direct identifier:

wtb lookup --ean 35000979087 --zip 10001 --format json

Useful overrides:

  • --app-id overrides the configured app id
  • --wtbid overrides the configured widget id
  • --lat and --lng can be used instead of ZIP when you already have coordinates

Diagnostics

wtb diag config --format json

This command fetches the configured app and widget metadata, which is useful when you are validating a new site config or a fresh environment.

Output Shape

JSON output is grouped into:

  • meta for product, location, config, and pagination information
  • online for retailer entries
  • in_store for 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.

Testing

python3 -m unittest discover -s tests -v

Set WTB_LIVE=1 to enable the optional live smoke scaffold in the test suite.

Agent Notes

When this CLI is wrapped by another tool, keep the request simple:

  • one product URL or one EAN/GTIN
  • one location input
  • optional --app-id or --wtbid overrides only when the default config needs to be replaced

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages