Weather
Fetch and display current weather and forecasts — no API key required.
Decision flow
- Identify the location from the user's request.
- If the user says "here", "my location", or gives no city, ask for the city name.
- URL-encode spaces:
New+York,São+Paulo. - Airport codes work:
JFK,LHR,NRT.
- Detect the platform (or infer from context):
- Linux / macOS / Git Bash →
curl - Windows PowerShell →
curl.exe(barecurlmaps toInvoke-WebRequestand may fail)
- Linux / macOS / Git Bash →
- Choose the format based on what the user wants:
- Quick one-liner →
format=3 - More detail (humidity, wind) → custom format string
- Full 3-day forecast →
?Tflag - Structured data / calculations → Open-Meteo JSON (see below)
- Quick one-liner →
wttr.in — primary source
One-line summary (default for most queries)
# Linux / macOS
curl -fsSL "https://wttr.in/London?format=3"
# → London: ⛅️ +8°C
# Windows PowerShell
curl.exe -s "https://wttr.in/London?format=3"
Compact with humidity and wind
# Linux / macOS
curl -fsSL "https://wttr.in/London?format=%l:+%c+%t+%h+%w"
# → London: ⛅️ +8°C 71% ↙5km/h
# Windows PowerShell
curl.exe -s "https://wttr.in/London?format=%l:+%c+%t+%h+%w"
Full 3-day forecast (plain text, renders as a table)
curl -fsSL "https://wttr.in/London?T" # Linux
curl.exe -s "https://wttr.in/London?T" # Windows
Current conditions only (no forecast days)
curl -fsSL "https://wttr.in/London?0" # Linux
curl.exe -s "https://wttr.in/London?0" # Windows
Units
Append to the URL query string:
| Suffix | Unit system |
|---|---|
?m |
Metric (°C, km/h) |
?u |
US customary (°F, mph) |
?M |
Metric with m/s wind |
| (none) | Auto-detected by IP |
Format codes (for custom format= strings)
| Code | Meaning |
|---|---|
%c |
Condition icon |
%t |
Temperature |
%f |
Feels-like |
%h |
Humidity |
%w |
Wind |
%p |
Precipitation |
%P |
Pressure |
%l |
Location name |
%m |
Moon phase |
Open-Meteo — fallback for structured/JSON use
Use when the user wants data for calculations, comparisons, or programmatic output. Requires coordinates (latitude/longitude).
# Linux / macOS
curl -fsSL "https://api.open-meteo.com/v1/forecast?latitude=51.5&longitude=-0.12¤t_weather=true"
# Windows PowerShell (cleanest for JSON)
Invoke-RestMethod -Uri "https://api.open-meteo.com/v1/forecast?latitude=51.5&longitude=-0.12¤t_weather=true"
Returns JSON: temperature, windspeed, winddirection, weathercode, time.
Add &hourly=temperature_2m,precipitation for hourly data, or &daily=temperature_2m_max,precipitation_sum for daily summaries. Docs: https://open-meteo.com/en/docs
WMO weather code → plain language
| Code | Description |
|---|---|
| 0 | Clear sky |
| 1–3 | Partly cloudy |
| 45, 48 | Fog |
| 51–67 | Drizzle / Rain |
| 71–77 | Snow |
| 80–82 | Rain showers |
| 85–86 | Snow showers |
| 95 | Thunderstorm |
| 96, 99 | Thunderstorm + hail |
Presenting results to the user
- Short query ("what's the weather in Paris?"): run
format=3, then restate in a natural sentence — "It's currently ⛅ 12°C in Paris." - Forecast request ("3-day forecast for Tokyo"): use the
?Tflag and display the text table directly — it's already nicely formatted. - JSON / Open-Meteo: translate
weathercodeto plain language; don't dump raw JSON at the user. - Fetch failure: if the city isn't found or the request times out, try an alternate spelling or ask the user to confirm the location.