view src/main.rs @ 2:5b14b84fc45c

Refine fetch logic and add logging
author Lewin Bormann <lbo@spheniscida.de>
date Fri, 20 Mar 2020 23:00:59 +0100
parents 44ae9c7bb872
children 6f4e48cd69b4
line wrap: on
line source

mod http;

use log::{info, warn};
use env_logger;

async fn test_fetch_page() -> hyper::Result<()> {
    let mut cl = http::HTTPS::new();
    let res = cl.get("https://audiophil-foto.de/de/shop/kameras/sony/".parse::<hyper::Uri>().unwrap()).await.unwrap();
    info!("Fetch 1 was {}", res.status);
    let res = cl.get("https://audiophil-foto.de/de/shop/kameras/nikon/".parse::<hyper::Uri>().unwrap()).await.unwrap();
    info!("Fetch 2 was {}", res.status);

    Ok(())
}

#[tokio::main]
async fn main() {
    env_logger::Builder::from_default_env().filter(None, log::LevelFilter::Info).init();

    info!("scrapeprice: init");
    test_fetch_page().await.unwrap();
}