Command-line client for the Warnely Public API: composite travel-safety scores for 180 countries combining UK FCDO, US State Department, Global Peace Index, World Bank Worldwide Governance Indicators, and a live news incident wire.
Single-file, zero dependencies. Pure Python stdlib. Installs to a single warnely binary.
# From git (no PyPI needed)
pip install "git+https://github.com/sn-lui/warnely-cli.git"Or just download warnely_cli.py, drop it on your PATH, and run it directly:
curl -O https://raw.githubusercontent.com/sn-lui/warnely-cli/main/warnely_cli.py
chmod +x warnely_cli.py
./warnely_cli.py TH# One country, full snapshot
warnely TH
# One-line summary
warnely TH --short
# 🇹🇭 Thailand (TH) — 38/100 · Exercise Increased Caution
# All 180 countries, sorted by score
warnely list
# Filter to a region
warnely list --region Asia
# Live incident wire
warnely incidents
warnely incidents --country TH --limit 10
# Methodology document
warnely methodology
# Raw JSON for piping into jq / scripts / notebooks
warnely TH --json | jq .country.risk_score
warnely list --json | jq '.[] | select(.region=="Europe") | .iso2'By default the CLI uses colour codes when stdout is a TTY. Pipe through anything (| less, | jq, > file.txt) and colours are stripped automatically. The NO_COLOR environment variable is respected.
| Command | What it does |
|---|---|
warnely <ISO> |
Shortcut for warnely country <ISO> |
warnely country <ISO> |
Full snapshot for one country |
warnely list |
All 180 countries (tabular) |
warnely incidents |
Recent items from the safety wire |
warnely methodology |
Composite formula + sources + tiers |
All commands accept --json for raw API output.
The Warnely API is fine for scripts, but for one-off questions ("how safe is Thailand?") the round trip through curl + jq is friction. This CLI makes the common cases trivial and respects shell idioms (pipeable, NO_COLOR, sensible exit codes).
The Warnely dataset is licensed CC BY 4.0. If you publish work derived from it, attribute Warnely with a link to https://warnely.com.
- OpenAPI spec + Python/TS SDKs: sn-lui/warnely-openapi
- Interactive docs: warnely.com/api-docs
- Country safety guides: warnely.com/guides