← 返回
开发者工具 中文

Yr Weather

Fetch weather forecasts from the Norwegian Meteorological Institute (MET) using the yr.no API. Use when the user asks for weather information, forecasts, tem...
从挪威气象局(MET)通过 yr.no API 获取天气预报。适用于用户询问天气信息、预报、温度等。
brandon2255p
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 563
下载
💾 13
安装
1
版本
#latest

概述

Yr.no Weather

Get weather forecasts from MET Norway via yr.no API (free, no key).

Quick Start

# Current weather + forecast (requires lat/lon)
python3 {baseDir}/scripts/weather.py <lat> <lon> [altitude]

# Examples from common locations:
python3 {baseDir}/scripts/weather.py -33.9288 18.4174   # Cape Town
python3 {baseDir}/scripts/weather.py -33.8688 151.2093  # Sydney
python3 {baseDir}/scripts/weather.py 51.5074 -0.1278    # London

# Tomorrow's summary (requires lat/lon)
python3 {baseDir}/scripts/tomorrow.py <lat> <lon>

# Run tests
python3 -m unittest discover {baseDir}/tests

Tests

  • Unit tests mock API calls (no network).
  • Sample data in scripts/tests/data/.
  • Run: cd {baseDir}/scripts && python3 ../tests/test_*.py

Common Locations

CityLatLon
-------------------------------------
Cape Town-33.928818.4174
Johannesburg-26.204128.0473
Durban-29.858731.0218
Sydney-33.8688151.2093
London51.5074-0.1278
New York40.7128-74.0060
Tokyo35.6762139.6503

Structure

scripts/
├── yr_service.py    # API calls (tested/mocked)
├── utils.py         # Emoji/symbol helpers
├── weather.py       # Current + forecast CLI
├── tomorrow.py      # Tomorrow summary CLI
└── tests/data/      # Sample JSON
tests/
├── test_weather.py
└── test_service.py

Standalone Repo

Install via pip: pip install git+https://github.com/brandoncrabpi/yr-weather.git

  • yr-weather -33.9288 18.4174
  • Tagged: v1.0.0

Usage Terms

  • User-Agent required (included).
  • Cache 10min+ per location.
  • Credit: "Data from MET Norway".

Refactored for production: no defaults, tests, modular service.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 01:45 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,731
developer-tools

Agent Browser

matrixy
专为AI智能体优化的无头浏览器自动化CLI,支持无障碍树快照和基于引用的元素选择。
★ 425 📥 118,029
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 66 📥 179,853