Qweather和风天气API示例代码
中文介绍
这个项目提供了完整的和风天气API集成解决方案,包含两个版本:
中文版:专为中文用户设计,返回结果字段已本地化为中文
英文版:专为国际用户设计,所有字段使用标准英文术语
主要功能:
使用获取实时天气数据(温度、湿度、风力等)
查询3天天气预报
获取空气质量指数
自动转换API返回字段为更友好的名称
简单易用的配置接口
使用步骤:
在和风天气平台注册获取API密钥
设置您的地区代码(LOCATION_ID)
选择适合您语言需求的版本运行
English Introduction
This project provides a complete QWeather API integration solution with two versions:
Chinese Version: Designed for Chinese users, with localized field names
English Version: Designed for global users, using standard English terminology
Key Features:
Get real-time weather data (temperature, humidity, wind, etc.)
Query 3-day weather forecasts
Retrieve air quality index
Automatic conversion of API fields to user-friendly names
Simple configuration interface
Getting Started:
Register on QWeather platform to obtain API key
Set your location ID (LOCATION_ID)
Run the version that matches your language needs
Repository Structure 项目结构
qweather-api-integration/
chinese_version/ 中文版本
qweather_chinese.py
README_CN.md 中文详细文档
english_version/ 英文版本
qweather_english.py
README.md 英文详细文档
examples/ 示例
haiyan_sample.json 海盐县示例数据
LICENSE
Usage Instructions 使用说明
中文用户
*安装依赖:pip install requests
编辑qweather_chinese.py:
设置API_KEY = "您的实际API密钥"
设置LOCATION_ID = "您的地区代码"
运行:python qweather_chinese.py
English Users
*Install dependencies: pip install requests
Edit qweather_english.py:
Set API_KEY = "your_actual_api_key"
Set LOCATION_ID = "your_location_code"
Run: python qweather_english.py