use std::collections::HashMap;
use std::thread::sleep;
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let three_seconds = Duration::from_secs(3);
loop {
println!("1234");
//---------------------
let resp = reqwest::get("https://httpbin.org/ip")
.await?
.json::<HashMap<String, String>>()
.await?;
println!("{:#?}", resp);
//---------------------
sleep(three_seconds); // 延迟3秒
}
Ok(())
}
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询