weather/current.py
Real current conditions for any city, via wttr.in's compact one-line format (%l: +%t %C) -- genuinely current, not a canned response. Outputs a single short phrase ready for captions or notifications, avoiding unrenderable emoji glyphs.
Use when the user asks what the weather is like right now somewhere, or a caption or notification needs a live conditions phrase.
- the file
- weather/current.py
- its skill
- weather/SKILL.md (the whole weather pack)
- as knowledge
- okf/weather/current.md
- on GitHub
- weather/current.py ↗
Run it
1. Once per machine: install fragletc (Docker must already be running).
curl -fsSL https://raw.githubusercontent.com/ofthemachine/fraglet/main/install.sh | sh
2. Fetch the tool and print its contract.
curl -fsSLO https://tools.ofthemachine.com/weather/current.py && chmod +x current.py && ./current.py --fraglet-help
3. Run it.
./current.py -p location="<location>"
Parameters
| name | type | requirement | description |
|---|---|---|---|
| location | string | required | City, region, or landmark, e.g. Vancouver or Mount Fuji |
Outputs
stdout
Provenance
- image
- ofthemachine/python3@sha256:a015b4f9f0e7c1648f8fcd4164f6a296dd3c9189404f88f333a9764d08d13522
- reach
network=required— output depends on live external state; do not cache indefinitely.- procedure_hash
- sha256:1ecc17f9d6bfb2c1f608e2b8a0dbbbf92a0f0072f16e90de8b435e45d581cd4a
- receipt
- add
--receipt run.jsonto any run;receipt/attest.pyverifies it against this hash without re-running.
Source
current.py · 21 lines · sha256 1ecc17f9d6bf…
#!/usr/bin/env -S fragletc --image ofthemachine/python3@sha256:a015b4f9f0e7c1648f8fcd4164f6a296dd3c9189404f88f333a9764d08d13522
#: d=Real current conditions for any city, via wttr.in's compact one-line format (%l: +%t %C) -- genuinely current, not a canned response. Outputs a single short phrase ready for captions or notifications, avoiding unrenderable emoji glyphs.
#: when=Use when the user asks what the weather is like right now somewhere, or a caption or notification needs a live conditions phrase.
#: network=required
#: stdin=none
#: param=location:required:d=City, region, or landmark, e.g. Vancouver or Mount Fuji
import os
import sys
import urllib.parse
import urllib.request
location = os.environ["LOCATION"]
url = "https://wttr.in/" + urllib.parse.quote(location) + "?format=%l:+%t+%C"
req = urllib.request.Request(url, headers={"User-Agent": "curl"})
try:
with urllib.request.urlopen(req, timeout=15) as resp:
print(resp.read().decode("utf-8", "replace").strip())
except urllib.error.URLError as e:
print(f"weather lookup failed: {e}", file=sys.stderr)
sys.exit(1)