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
1
vote
2 answers

rust - Why am I getting an invalid request error using twitter api

So over at the twitter api documentation, it says to generate a Bearer token you run this command curl --user "$API_KEY:$API_SECRET_KEY" \ --data 'grant_type=client_credentials' \ 'https://api.twitter.com/oauth2/token' I run it and the result I…
HippoBaguette
  • 308
  • 4
  • 15
1
vote
1 answer

Get C FILE pointer from bytes::Bytes in Rust

I would like to read a GRIB file downloaded from server using ecCodes library in Rust. However, my current solution results in segmentation fault. The extracted example, replicating the problem, is below. I download the file using reqwest crate and…
J.Lewandowski
  • 71
  • 1
  • 11
1
vote
2 answers

Errors with reqwest example in Rust Playground and local machine

I'm messing arround with the reqwest library and wanted to try some examples with Rust Playground. I have taken one of the simplest examples from the web but it does not compile. Please follow the link below and click…
Dani P.
  • 1,073
  • 1
  • 10
  • 28
1
vote
1 answer

Sending attachment with reqwest

I'm trying to do a POST request using reqwest. I need to send attachments in my request. I am looking for the equivalent of curl -F attachment=@file.txt In older versions (see here) it was as simple as let file =…
1
vote
0 answers

How to handle errors in RUST with reqwest library in async mode?

With rust 1.49 and reqwest 0.11.0, i would like to retrieve a URL, and react on possible errors (wrong URL, no network, ...). My (simplifed) base code is (and this is working) : async fn test_url() -> Result<(), reqwest::Error> { let response =…
SRG
  • 1,569
  • 1
  • 17
  • 19
1
vote
3 answers

Why get method is not returning a Response object in reqwest?

I'm trying to replicate an example from reqwest documentation. Here is the example: let body = reqwest::get("https://www.rust-lang.org")? .text()?; After I have added the reqwest = "0.10.10" line in the file Cargo.toml, I add the following code in…
Lucas
  • 1,166
  • 2
  • 14
  • 34
1
vote
0 answers

How to share reqwest::Client between concurrent requests?

I'm having trouble getting the reqwest crate to perform a bunch of async requests while reusing the same client. If I don't use a client and just use the provided get interface, everything works fine. Essentially I'm just fetching a list of items…
jpsalm
  • 328
  • 1
  • 8
1
vote
1 answer

Rust reqwest example json code does not compile

The example for dynamic json with reqwest extern crate reqwest; extern crate tokio; extern crate serde_json; // added to after upgrade to 1.39.0 #[tokio::main] async fn main() -> Result<(), reqwest::Error> { let echo_json: serde_json::Value =…
serv-inc
  • 35,772
  • 9
  • 166
  • 188
1
vote
0 answers

Multiple futures via join_all that each return a String which is fetched via Reqwest

pub static MAX_BLOCK_SIZE: u32 = 1024*1024; //Please do not exceed this value, or the webserver will deny your request. pub static ENABLE_DEBUG: bool = false; //Enable temporarily if you're encountering problems with fetching the data pub static…
Thomas Braun
  • 505
  • 3
  • 14
1
vote
1 answer

Why are images downloaded with Reqwest's .text() method broken?

How do I retrieve an image on some website and save it to local using Reqwest correctly? I have tried to use .text() and the image are broken. Error interpreting JPEG image file (Not a JPEG file: starts with 0xef 0xbf) The code that I have…
Andra
  • 1,282
  • 2
  • 11
  • 34
1
vote
1 answer

Reqwest's Client.post() returning 400 bad request for File.io API

I'm learning Rust, and thought it would be handy to build a CLI to share files with the File.io API. To do so, I am trying to use reqwest to send a request as described in the File.io docs: # from file.io doc -> works fine $ curl --data "text=this…
1
vote
1 answer

Why does creating a simple Reqwest Client panic?

When I run this I get an error: fn main() { let client = reqwest::Client::new(); } thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:345:21 I also tried it with the builder but the error remains…
Nipun Garg
  • 125
  • 6
1
vote
0 answers

Making a request to https://eth0.me with Reqwest hangs on send()

Note: This issue was caused by my using HTTPS when the site only supported HTTP. Check this if you're having this issue! I'm trying to make a small web crawler in Rust. When I try to send a GET request using the reqwest library, the program…
thatlittlegit
  • 69
  • 1
  • 8
0
votes
1 answer

Simple recipe for authenticated request?

I'm trying to do the equivalent in Rust of a simple Python requests.get to an "https" domain. I should stress that my knowledge of authentication, certificates, proxies, etc. is virtually nil. I found this question, but I'm not sure what this is…
mike rodent
  • 14,126
  • 11
  • 103
  • 157
0
votes
0 answers

Trunk doesn't recognize reqwest features

I'm trying to run a Yew app using Trunk that uses reqwest to get contents of a GitHub repo. For that, I need some extra reqwest features, but Trunk throws out this error: error[E0433]: failed to resolve: could not find `blocking` in `reqwest` …
tigerros
  • 73
  • 1
  • 6