Questions tagged [reqwest]

reqwest is a high-level Rust HTTP client library that aims to be convenient and capable.

Documentation is available at https://docs.rs/reqwest/latest/reqwest/

215 questions
0
votes
0 answers

Is there something like Promise.race() when using Reqwest in Rust?

I would like to make multiple HTTP requests and once one returns, cancel the others. Something like Promise.race() in JavaScript. Is there anywhere to do this with reqwest? Or is this something that needs to be done via tokio? if so how?
Finlay Weber
  • 2,989
  • 3
  • 17
  • 37
0
votes
0 answers

How can I perform multiple concurrent requests with reqwest using a shared client reference?

I am trying to perform multiple concurrent GET requests using the reqwest library, while using a shared reference to the Client object. The idea is this will be a long-lived client, and as suggested in the docs, I would like to take advantage of the…
Lukas S.
  • 5,698
  • 5
  • 35
  • 50
0
votes
0 answers

GET Request to the Notion Database API throwing 401 status code (using reqwest)

I'm working on a wasm rust app with Yew, and trying to retrieve database entries from Notion to fill the app's body content. I'm using reqwest to do all the http requesting part, but no matter what I do it keeps returning a 401 status code. I've…
0
votes
1 answer

reqwest - dynamically determine file_name for multipart::Part

I am using reqwest to send a jar file to an api using multipart. This is what I have so far: use std::path::PathBuf; use anyhow::Result; use reqwest::{multipart, Body, Client}; use tokio::fs::File; use tokio_util::codec::{BytesCodec,…
0
votes
0 answers

How can I return a vector of responses from a set of concurrent GET requests?

I'm just getting started with Rust and am trying to work with concurrent requests. My aim is to have an asynchronous function that returns a vector of responses from a number of GET requests. What I have currently does successfully execute the…
Xylot
  • 55
  • 3
0
votes
1 answer

Rust: Response error handling using reqwest

Ok, so I'm very new to Rust and I'm trying to clumsily piece together a little CLI tool that makes http requests and handles the responses, by using tokio, clap, reqwest and serde. The tool accepts a customer number as input and then it tries to…
habjo
  • 19
  • 8
0
votes
1 answer

Cannot solve compiler errors while extracting reqwest::Response from a reqwest::Client request

I'm having a hard time trying to figure out how to error handle this piece of code. This is the endpoint of my actix_web api, up until now everything works: pub async fn simple_moving_average() -> HttpResponse { if Client::new() …
amongosus
  • 45
  • 6
0
votes
0 answers

Using tokio::sync::Semaphore to limit async requests in a block

I am working with an API that limits me to 40 requests per second, and 200 every 120 seconds. I am currently designing an async pattern in Rust using reqwest and tokio. I want to incorporate the rate limiting constraints. I have done similar things…
Coldchain9
  • 1,373
  • 11
  • 31
0
votes
1 answer

reqwest post request freezes after random amount of time

I started learning rust 2 weeks ago, and has been making this application that watches a log file, and sends a bulk of the information to an elasticsearch DB. The problem is that after certain amount of time, it freezes (using 100% CPU) and I don't…
Typewar
  • 825
  • 1
  • 13
  • 28
0
votes
0 answers

unable to pass reqwest::multipart::Form variable as a parameter to closure

I want to execute a post request using reqwest and retry it in case of error. To retry I am using again crate. My code looks like this: pub async fn post_part(&self, url: &str, headers: HeaderMap, body: Form) -> Result { …
zeeshan
  • 33
  • 1
  • 7
0
votes
1 answer

How do I get an html page in synchronous code without using reqwest::blocking?

I need to make a function that will receive an HTML page from the link. Since I use the yew library, WASM does not allow me to use many custom libraries and functions. For example, the library Tokio, future and the function…
user15233994
0
votes
1 answer

Why does my program get stuck at epoll_wait?

I have some structs that are used to de-serialize requests from GCP alerting. The top-level structs implement FromResponse, and the nested structs all implement serde's Deserialize and Serialize traits. Here are the structs (omitted ones that are…
0
votes
1 answer

Why do I get the error unsupported_grant_type when trying to make a POST request to Spotify API when trying to get a token?

Trying to fetch a token from the Spotify API using reqwest. Keep getting this error from the response: {"error":"unsupported_grant_type","error_description":"grant_type parameter is missing"} Tried multiple solutions: adding grant_type as…
0
votes
0 answers

How to integrate async data collection with threadpool data processing in Rust

I'd like to improve the integration of my async data collection with my rayon data processing by overlapping the retrieval and the processing. Currently, I pull lots of pages from a web site using normal async code. Once that is complete, I do the…
0
votes
1 answer

How to change JA3 token in the rust reqwest crate

so my question is how do I change the JA3 token in the reqwest crate rust? I tried looking in the docs but got no help. If there is a crate in rust that allows this then please let me know. It will be highly appreciated.