reqwest icon indicating copy to clipboard operation
reqwest copied to clipboard

Blocking client timeout

Open Poswn opened this issue 8 months ago • 7 comments

I'm converting my python project over to rust and but I'm getting the timed out error on the request and haven't the foggiest idea why, I'm guessing it's something todo with the user agent header but its the same in my python project. I'm using the blocking client as I'm only doing one request.

Code:

const URL: &str = "https://www.minecraft.net/en-us/download/server/bedrock";

let client = reqwest::blocking::Client::builder()
    .connect_timeout(Duration::from_secs(10))
    .timeout(Duration::from_secs(10))
    .build()?;

let res = client.get(URL)
    .header(USER_AGENT, "Mozilla/5.0 (X11; CrOS x86_64 12871.102.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.141 Safari/537.36")
    .send()?
    .text()?;

Error:

Error: reqwest::Error {
    kind: Request,
    url: Url {
        scheme: "https",
        cannot_be_a_base: false,
        username: "",
        password: None,
        host: Some(Domain("www.minecraft.net")),
        port: None,
        path: "/en-us/download/server/bedrock",
        query: None,
        fragment: None
    },
    source: TimedOut
}

Poswn avatar Oct 07 '23 22:10 Poswn