use atlas_http::{HttpBody, HttpClient, HttpRequest, HttpResponse, HttpSyncClient};
const USER_AGENT: &str = "Mozilla/5.0 (X11; Linux x86_64; rv:130.0) Gecko/20100101 Firefox/130.0";
const BROWSER_HEADERS: &[&str] = &[
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
"Accept-Language: en-US,en;q=0.5",
"Accept-Encoding: identity",
];
pub(crate) fn build_client() -> HttpSyncClient {
HttpClient::builder().user_agent(USER_AGENT).timeout(30).read_timeout(20).build_sync()
}
pub(crate) fn get(client: &mut HttpSyncClient, url: &str) -> Result<HttpResponse, atlas_http::error::Error> {
let headers: Vec<&str> = BROWSER_HEADERS.to_vec();
let req = HttpRequest::new("GET", url, &headers, &HttpBody::empty());
client.send(&req)
}
pub(crate) fn build_browser_client() -> HttpSyncClient {
HttpClient::builder().user_agent(USER_AGENT).timeout(30).read_timeout(20).browser().build_sync()
}