# Python Port — Step 1: `simple.py` ## Goal The simplest possible latency-checking script: read a plain-text list of sites, issue a GET to each, report whether it was reachable and how long it took. No phase breakdown, no flags beyond the config-file path. ~50 lines. ## Input `python simple.py [sites.txt]` - Positional argument: path to the plain-text config (default: `sites.txt` in cwd). - Config format: one URL per line; `#` introduces a comment; blank lines ignored. Forward-compatible with trailing `key=value` tokens that future steps may add (the parser strips everything after the first whitespace token when reading the URL). ## Output One line per site, aligned in three columns: ``` OK 147.11 ms https://example.com FAIL (connection refused) http://localhost:8080 FAIL (name or service not known) https://nonexistent.invalid ``` - `OK` / `FAIL` tag (7 chars padded), ms formatted as `%.2f ms`, then URL. - All output goes to `stdout`. - Exit `0` if every site returned a response (any HTTP status); `1` if any failed. ## Implementation - `urllib.request.urlopen(url, timeout=10)` wrapped in a try/except. - Timing: `time.perf_counter()` bracketed around `urlopen` + `resp.read()` (drain body so the number is real wall-clock including transfer). - Catch `urllib.error.URLError` and `Exception` for any network failure; extract the reason string for the FAIL message. - Stdlib only: `urllib.request`, `urllib.error`, `time`, `sys`. ## Files - `python/simple.py` — the script - `python/sites.txt` — example config (committed as a sample) - `docs/usage/py-simple.md` — user-facing doc - Makefile `py-simple-run` and `py-test` (empty stub) targets, wired into umbrella `test` - CHANGELOG.md entry