http_download

Function http_download 

Source
pub fn http_download(
    _py: Python<'_>,
    url: String,
    filepath: String,
    params: Option<&Bound<'_, PyAny>>,
    headers: Option<HashMap<String, String>>,
    timeout_secs: Option<u64>,
) -> PyResult<()>
Expand description

Downloads a file from URL to filepath using streaming.

Uses reqwest::blocking::Client to stream the response directly to disk, avoiding loading large files into memory.

ยงErrors

Returns an error if:

  • Parent directories cannot be created.
  • The HTTP client fails to build.
  • The HTTP request fails (e.g., network error, timeout, invalid URL).
  • The server returns a non-success status code.
  • The file cannot be created or written to.
  • The params argument is not a dict.