The Panama Postal CLI (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/kass507/panama-postal/llms.txt
Use this file to discover all available pages before exploring further.
panama_postal_cli.py) lets you decode, validate, and enrich postal codes directly from your terminal without writing any Python code. It supports two usage modes: an interactive prompt loop for exploratory work, and a non-interactive mode for scripting or batch lookups. No external dependencies are required beyond Python 3.10+.
Installation
pip install step. The CLI runs directly with the Python interpreter.
Available Flags
| Flag | Effect |
|---|---|
--laxo | Uses the official site’s permissive bounding box (lat 6–11, lng −86 to −74) instead of the strict Panama territory bounding box |
--no-location | Skips province/district/corregimiento/poblado/barrio lookup — faster and requires no network connection |
Usage Modes
- Interactive
- Non-interactive
Interactive mode launches a prompt loop where you can enter codes one at a time. This is the default when no code arguments are provided.The CLI prints a header and, if
Launch the interactive prompt
estafeta.geojson.gz is present, reports how many estafeta polygons were loaded. If the file is missing, it shows the download command as a reminder.Enter a postal code
At the The result is printed immediately below your input.
código> prompt, type any valid Panama postal code and press Enter:Review the output
The CLI displays coordinates, precision level, estafeta data (if available), and the full political division hierarchy. A Google Maps link is always included.
Look up additional codes
Continue entering codes at the prompt. Each result is printed and the prompt reappears.
Sample Output
A successful lookup for a valid code inside Panama looks like this:ANSI Color Output
The CLI uses ANSI escape codes to color-code results at a glance:Green — Valid
The code has a valid format and its coordinates fall inside Panama.
Yellow — Outside Panama
The format is valid but the decoded coordinates fall outside the Panama bounding box.
Red — Invalid
The code cannot be parsed: it contains illegal characters, has the wrong length, or is not a string.
Data File Enrichment
The CLI automatically detects which optional data files are present in the working directory and adjusts its output accordingly.With estafeta.geojson.gz
With estafeta.geojson.gz
The estafeta name (
Estafeta de Paraiso), internal zone code (A6199 = AC), and coverage area in km² are displayed for every valid code. The index is loaded once at startup.Download the file with:Without estafeta.geojson.gz
Without estafeta.geojson.gz
The
Estafeta, Zona postal, and Área lines are omitted. Decoding, validation, and coordinate output still work normally. The CLI prints a reminder at startup with the download command.With political division GeoJSON files
With political division GeoJSON files
When any of the five boundary files (
PROVINCIAS.geojson.gz, DISTRITOS.geojson.gz, CORREGIMIENTOS.geojson.gz, POBLADOS.geojson.gz, BARRIOS.geojson.gz) are present, the corresponding division levels are resolved locally — no network request needed.Without political division GeoJSON files
Without political division GeoJSON files
The CLI automatically calls the official remote endpoint (
/api/location) to resolve province, district, corregimiento, poblado, and barrio. Pass --no-location to skip this lookup entirely.