1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub use crate::reqwest::blocking::{Client};
use reqwest::StatusCode;

pub fn fetch_page_html(url: &str, client: &Client) -> String {
    let mut body = String::new();

    // silence errors for top level logging
    match client.get(url).send() {
        Ok(res) if res.status() == StatusCode::OK => match res.text() {
            Ok(text) => body = text,
            Err(_) => {},
        },
        Ok(_) => (),
        Err(_) => {}
    }

    body
}