I am trying to do a Basic Authentication GET, ignoring certificate validation, using reqwests.
I have following Python requests code, which works:
import requestsfrom requests.auth import HTTPBasicAuthsession = requests.sessions.Session()session.auth = HTTPBasicAuth("username", "password")session.verify = Falseresponse = session.get("http://myurl.com/myapi")I want to do the same thing using Rust reqwest.So far, I have the following:
use reqwestlet url = "http://myurl.com/myapi";let response = reqwest::Client::builder() .danger_accept_invalid_certs(true) .build() .unwrap() .get(&url) .basic_auth("username", Some("password")) .send() .await?;The Python requests call works as expected. However, I get the following response from Rust:
Error: reqwest::Error { kind: Request, url: Url { scheme: "https", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("myurl.com")), port: None, path: "myapi", query: None, fragment: None }, source: Error { kind: Connect, source: Some("unsuccessful tunnel") } }If I need to produce more code (I can't provide the actual URL), please let me know.