Issues making web request with reqwest


I am exploring "reqwest" library, I did some test with get method.

If I use "Blocking::get", it is working ok but if I try to use simple "Get", I don't get any compiling error but when I execute my code I get this error:

"thread 'main' panicked at 'not currently running on the Tokio runtime.', src/libcore/".

Any clue?

async fn http_request_3(_site: String) -> Result<()>{

    let mut _result = reqwest::get(&_site).await?;
    let mut _status = String::new();



Are you using async-std? You need to use the Tokio runtime instead to use reqwest.

Tip: If you use three backticks instead of four spaces in your code blocks, you get syntax highlighting.

// your code

Thank you Alice, I will try in that way.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.