Free weather service, no API Key required, supports Chinese.
Command-line usage
# 查询城市天气(默认简洁一行输出)
python3 skills/weather/scripts/weather.py query 北京
# 详细模式(多行格式化输出)
python3 skills/weather/scripts/weather.py query 上海 --detailed
# 查看多日预报
python3 skills/weather/scripts/weather.py forecast 深圳
# 仅今天
python3 skills/weather/scripts/weather.py forecast 广州 --days 1
JSON output (recommended for AI use, optimized into a concise format)
python3 skills/weather/scripts/weather.py query Dongguan --json
English city namepython3 skills/weather/scripts/weather.py query London --lang en
Specify units (metric/uscs)python3 skills/weather/scripts/weather.py query Tokyo --units uscs
## AI 调用场景
用户说"今天北京天气怎么样":
```bash
python3 skills/weather/scripts/weather.py query 北京 --json
User says "Is this weekend good for going out?":
python3 skills/weather/scripts/weather.py forecast 当前城市 --json
User says "Do I need to bring an umbrella tomorrow?":
python3 skills/weather/scripts/weather.py query 当前城市 --json
Alternative method (curl)
If the Python script is unavailable, you can use curl directly:
# 快速查询
curl -s "wttr.in/Beijing?format=3"
# 完整预报
curl -s "wttr.in/Beijing?lang=zh"
# 自定义格式
curl -s "wttr.in/Beijing?format=%l:+%c+%t+%h+%w"
Format codes:%c Weather · %t Temperature · %h Humidity · %w Wind speed · %l Location · %m Moon phase
Notes
- City names support Chinese, English, and pinyin
- Use
+for spaces in URLs - Supports airport codes (e.g., JFK)
?mMetric /?uUS customary