← 返回
未分类 Key

Amap Weather (高德天气)

Query weather via Amap (高德) Weather API — China's most accurate location-based weather service. Use when user asks about weather in Chinese cities, mentions...
通过高德天气API查询天气——中国最精准的基于位置天气服务。当用户询问中国城市天气或提及相关地点时使用。
wyatt88 wyatt88 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 366
下载
💾 1
安装
1
版本
#latest

概述

Amap Weather (高德天气)

Prerequisites

  • AMAP_API_KEY environment variable (高德 Web 服务 API Key)
  • Apply at https://lbs.amap.com → 控制台 → 应用管理 → 创建应用 → 添加 Key (Web服务类型)

Quick Usage

Run the bundled script:

# Real-time weather (实况)
python3 scripts/amap_weather.py 北京

# 4-day forecast (预报)
python3 scripts/amap_weather.py 杭州 --forecast

# By adcode (区县级精度)
python3 scripts/amap_weather.py 110108 --forecast   # 海淀区

# Raw JSON output
python3 scripts/amap_weather.py 上海 --json

The script accepts city names (中文) or 6-digit adcodes. It has a built-in lookup table for 40+ major cities. For districts or less common cities, use adcodes directly.

Direct API Call (without script)

# Real-time
curl -s "https://restapi.amap.com/v3/weather/weatherInfo?key=${AMAP_API_KEY}&city=110000&extensions=base"

# Forecast
curl -s "https://restapi.amap.com/v3/weather/weatherInfo?key=${AMAP_API_KEY}&city=110000&extensions=all"

Parse the JSON: lives[0] for real-time, forecasts[0].casts[] for forecast (4 days).

Key Details

  • extensions=base → real-time → lives[] (temperature, weather, humidity, wind)
  • extensions=all → forecast → forecasts[].casts[] (4 days, day/night split)
  • adcode 6-digit code required (not city name in API). Script handles name→adcode mapping.
  • Updates: real-time hourly, forecast at ~8:00/11:00/18:00 CST
  • Free quota: 300k calls/day

Formatting Output

When presenting weather to users:

  • Use weather emoji (☀️晴 ⛅多云 🌧雨 ❄️雪 🌫雾 😷霾)
  • Temperature in °C
  • Include wind and humidity for real-time
  • For forecast, show day/night separately with high/low temps

API Reference

For complete field definitions, error codes, and adcode list: see references/api-docs.md.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 04:51 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

life-service

Caldav Calendar

asleep123
使用 vdirsyncer + khal 同步并查询 CalDAV 日历(iCloud、Google、Fastmail、Nextcloud 等)。适用于 Linux。
★ 244 📥 30,672
life-service

Weather

steipete
获取当前天气和预报(无需API密钥)
★ 457 📥 229,285
knowledge-management

Deep Research 🔬

wyatt88
具备多轮搜索、交叉验证及引用式结构报告的深度网络研究。将 web_search 和 web_fetch 增强为完整研究……
★ 0 📥 497