pub struct FetchClient { /* private fields */ }Expand description
HTTP client for fetching data from Yahoo Finance.
Provides cookie management, proxy support, and various fetch methods for different content types (HTML, JSON).
Implementations§
Source§impl FetchClient
impl FetchClient
Sourcepub fn auth_proxy(&self) -> Option<&String>
pub fn auth_proxy(&self) -> Option<&String>
Get the proxy URL to use for auth requests only.
Get a reference to the cookie jar.
Sourcepub async fn fetch(&self, url: &str) -> Result<String, YahooError>
pub async fn fetch(&self, url: &str) -> Result<String, YahooError>
Fetch a URL and return the response body as a string.
Sourcepub async fn fetch_json(&self, url: &str) -> Result<String, YahooError>
pub async fn fetch_json(&self, url: &str) -> Result<String, YahooError>
Fetch a URL expecting JSON response with proper Accept header.
Sourcepub async fn fetch_json_with_timeout(
&self,
url: &str,
timeout: Duration,
) -> Result<String, YahooError>
pub async fn fetch_json_with_timeout( &self, url: &str, timeout: Duration, ) -> Result<String, YahooError>
Fetch a URL expecting JSON response with timeout and proper Accept header. Note: Accept-Encoding is not set to avoid compression issues with JSON parsing.
Sourcepub async fn fetch_with_timeout(
&self,
url: &str,
timeout: Duration,
) -> Result<String, YahooError>
pub async fn fetch_with_timeout( &self, url: &str, timeout: Duration, ) -> Result<String, YahooError>
Fetch a URL with a custom timeout.
Sourcepub async fn fetch_response(&self, url: &str) -> Result<Response, YahooError>
pub async fn fetch_response(&self, url: &str) -> Result<Response, YahooError>
Fetch a URL and return the raw response.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FetchClient
impl !UnwindSafe for FetchClient
impl Freeze for FetchClient
impl Send for FetchClient
impl Sync for FetchClient
impl Unpin for FetchClient
impl UnsafeUnpin for FetchClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more