spidr/lib.rs
1extern crate reqwest;
2
3use std::collections::HashMap;
4
5pub fn test_reqwest() -> Result<(), Box<std::error::Error>> {
6 let resp: HashMap<String, String> = reqwest::get("https://httpbin.org/ip")?
7 .json()?;
8 println!("{:#?}", resp);
9 Ok(())
10}
11
12pub fn another_query() -> Result<(), Box<std::error::Error>> {
13 let body = reqwest::get("https://jaredforthmusic.com")?
14 .text()?;
15
16 println!("The body: {}", body);
17 Ok(())
18}