Crates.io | qweather-sdk |
lib.rs | qweather-sdk |
version | 0.4.0 |
source | src |
created_at | 2024-07-02 11:46:54.841217 |
updated_at | 2024-09-20 07:20:58.903611 |
description | Client SDK for QWeather API |
homepage | https://github.com/foxzool/qweather-sdk |
repository | https://github.com/foxzool/qweather-sdk |
max_upload_size | |
id | 1289529 |
size | 289,327 |
在项目下创建.env
文件,内容如下:
QWEATHER_ID=your_id
QWEATHER_KEY=your_key
use std::env;
use dotenvy::dotenv;
use qweather_sdk::client::{ClientConfig, QWeatherClient};
#[tokio::main]
async fn main() {
dotenv().expect(".env file not found");
env_logger::init();
let id = env::var("QWEATHER_ID").unwrap();
let key = env::var("QWEATHER_KEY").unwrap();
let client_config = ClientConfig::new(id, key);
let client = QWeatherClient::with_config(client_config);
let resp = client.weather_now("101010100").await.unwrap();
println!("{:#?}", resp);
}
GeoAPI
城市天气
分钟预报
格点天气
预警
天气指数
空气质量(beta)