Skip to content

Commit

Permalink
Remove PyException
Browse files Browse the repository at this point in the history
  • Loading branch information
deedy5 committed Aug 18, 2024
1 parent 0fd60b6 commit b1d9990
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bytes::Bytes;
use indexmap::IndexMap;
use pyo3::prelude::*;
use pyo3::types::{PyBytes, PyDict};
use pyo3::exceptions::{PyException, PyValueError};
use pyo3::exceptions::PyValueError;
use rquest::header::{HeaderMap, HeaderName, HeaderValue, COOKIE};
use rquest::tls::Impersonate;
use rquest::multipart;
Expand Down Expand Up @@ -182,7 +182,7 @@ impl Client {
}

let client =
Arc::new(client_builder.build().map_err(|err| PyException::new_err(err.to_string()))?);
Arc::new(client_builder.build()?);

Ok(Client {
client,
Expand Down Expand Up @@ -334,7 +334,7 @@ impl Client {
}

// Send the request and await the response
let resp = request_builder.send().await.map_err(|err| PyException::new_err(err.to_string()))?;
let resp = request_builder.send().await?;

// Response items
let cookies: IndexMap<String, String, RandomState> = resp
Expand All @@ -348,7 +348,7 @@ impl Client {
.collect();
let status_code = resp.status().as_u16();
let url = resp.url().to_string();
let buf = resp.bytes().await.map_err(|err| PyException::new_err(err.to_string()))?;
let buf = resp.bytes().await?;

log::info!("response: {} {} {}", url, status_code, buf.len());
Ok((buf, cookies, headers, status_code, url))
Expand Down

0 comments on commit b1d9990

Please sign in to comment.