lazyanki-parser 0.1.2

Web scraping dictionary and parsing utilities for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use reqwest::{
    Client,
    header::{ACCEPT_LANGUAGE, HeaderMap, HeaderValue},
};

pub async fn get_client(native_lang_tag: String) -> anyhow::Result<Client> {
    let mut headers = HeaderMap::new();

    headers.insert(ACCEPT_LANGUAGE, HeaderValue::from_str(&native_lang_tag)?);
    let client = reqwest::Client::builder()
        .default_headers(headers)
        .build()?;

    Ok(client)
}