#reqwest #partial #retries #retry #customizable #stream #timeout

reqwest-partial-retry

Wrapper around reqwest to allow for easy partial retries

2 releases

0.1.1 Nov 11, 2023
0.1.0 Nov 6, 2023

#326 in HTTP client

42 downloads per month

MIT/Apache

26KB
462 lines

reqwest-partial-retry

Wrapper around reqwest to allow for easy partial retries

Features

  • Customizable retry policy
  • Customizable retry strategy
  • Customizable stream timeout
  • Retries use the Range Header if possible

Example

use futures_util::StreamExt;
use reqwest_partial_retry::ClientExt;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::new().resumable();
    let request = client.get("http://httpbin.org/ip").build().unwrap();
    let mut stream = client
        .execute_resumable(request)
        .await?
        .bytes_stream_resumable();

    while let Some(item) = stream.next().await {
        println!("Bytes: {:?}", item?);
    }

    Ok(())
}

Thanks


lib.rs:

Wrapper around reqwest to allow for easy partial retries

Example

use futures_util::StreamExt;
use reqwest_partial_retry::ClientExt;

let client = reqwest::Client::new().resumable();
let request = client.get("http://httpbin.org/ip").build().unwrap();
let mut stream = client
    .execute_resumable(request)
    .await?
    .bytes_stream_resumable();

while let Some(item) = stream.next().await {
    println!("Bytes: {:?}", item?);
}

Dependencies

~9–23MB
~348K SLoC