ClawSkills logoClawSkills

Google Weather

Google Weather API — 准确、实时的天气数据。获取当前状况、温度、湿度、风力和预报。由 Google 的 Weather API 提供支持...

介绍

# Google Weather - Real-time Weather Data

使用 Google Weather API 获取准确的天气状况。需要已启用 Weather API 的 Google Cloud API 密钥。

## 快速使用

```bash # Current weather (formatted output) python3 skills/google-weather/lib/weather_helper.py current "New York" python3 skills/google-weather/lib/weather_helper.py current "London" python3 skills/google-weather/lib/weather_helper.py current "Sydney"

# 24h Forecast python3 skills/google-weather/lib/weather_helper.py forecast "Tel Aviv"

# Raw JSON data python3 skills/google-weather/lib/weather_helper.py json "Paris" ```

## 示例输出

``` *New York* Partly Cloudy ⛅ 🌡️ 12°C (feels like 10°C) 💨 Wind: 18 km/h NORTHWEST 💧 Humidity: 55% ```

``` *24h Forecast for Tel Aviv* 18:00: 17.8°C, ☀️ 5 km/h NORTH 22:00: 14.3°C, ☀️ 6 km/h EAST_NORTHEAST 02:00: 12.8°C, ⛅ 8 km/h NORTHEAST 06:00: 10.8°C, ☀️ 6 km/h EAST_NORTHEAST 10:00: 16.1°C, ☀️ 5 km/h SOUTH 14:00: 20.4°C, 🌤️ 8 km/h WEST_NORTHWEST ```

## 支持的位置

全球任何位置 - 只需输入城市名称: - `New York`、`London`、`Paris`、`Berlin`、`Sydney` - `San Francisco`、`Berlin`、`Singapore`、`Dubai` - 或任何地址、地标或坐标

该技能会利用 Google Maps API 自动对位置进行地理编码。

## 可用数据

- **温度**:当前温度 + 体感温度 - **天气状况**:晴、多云、雨、雪等,配有 emoji 图标 - **预报**:温度、风速和天气状况的逐时数据 - **湿度**:百分比 - **风**:风速、风向、阵风 - **紫外线指数**:日晒强度等级 - **降水**:概率和类型 - **云量**:百分比 - **能见度**:距离

## 设置

1. 在 [Google Cloud Console](https://console.cloud.google.com/) 中创建一个项目 2. 启用 [Weather API](https://console.cloud.google.com/apis/library/weather.googleapis.com) 3. 启用 [Geocoding API](https://console.cloud.google.com/apis/library/geocoding-backend.googleapis.com)(用于查找位置名称) 4. 创建一个 API 密钥,并将其设置为 `GOOGLE_API_KEY` 环境变量

> 如果您已经配置了相应的密钥,也支持 `GOOGLE_WEATHER_API_KEY` 或 `GOOGLE_MAPS_API_KEY`。

## 多语言支持

输出会根据位置进行调整 - 基于 `language` 参数支持英语、希伯来语和其他语言。

```bash # Hebrew output python3 skills/google-weather/lib/weather_helper.py current "Tel Aviv" # Output: בהיר ☀️ 19°C... ```

更多产品