pub struct Client { /* private fields */ }Expand description
Synchronous Anti-Captcha client.
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(api_key: impl Into<String>) -> Result<Self>
pub fn new(api_key: impl Into<String>) -> Result<Self>
Creates a client and the runtime that drives it.
Fails only when the Tokio runtime cannot be started.
Sourcepub fn from_async(inner: Client) -> Result<Self>
pub fn from_async(inner: Client) -> Result<Self>
Wraps an already configured async client.
pub fn set_api_key(&mut self, api_key: impl Into<String>)
Sourcepub fn configure(&mut self, change: impl FnOnce(Client) -> Client)
pub fn configure(&mut self, change: impl FnOnce(Client) -> Client)
Applies a builder method of the async client, e.g.
client.configure(|c| c.with_soft_id(1187).quiet()).
Sourcepub fn file_to_base64(path: impl AsRef<Path>) -> Result<String>
pub fn file_to_base64(path: impl AsRef<Path>) -> Result<String>
Reads a file and encodes it in base64.
Sourcepub fn get_balance(&self) -> Result<f64>
pub fn get_balance(&self) -> Result<f64>
Account balance in US dollars.
Sourcepub fn get_credits_balance(&self) -> Result<f64>
pub fn get_credits_balance(&self) -> Result<f64>
Number of prepaid captcha credits on the account.
Sourcepub fn json_request(&self, method: &str, payload: Value) -> Result<Value>
pub fn json_request(&self, method: &str, payload: Value) -> Result<Value>
Calls any API method with your own payload.
Sourcepub fn create_task(&self, task: Value) -> Result<i64>
pub fn create_task(&self, task: Value) -> Result<i64>
Submits a task and returns its id.
Sourcepub fn wait_for_result(&self, task_id: i64) -> Result<Solution>
pub fn wait_for_result(&self, task_id: i64) -> Result<Solution>
Polls until the task is solved or the waiting limit runs out.
Sourcepub fn solve_task(&self, task: Value) -> Result<Solution>
pub fn solve_task(&self, task: Value) -> Result<Solution>
Sends a task type this library does not wrap yet.
pub fn solve_image( &self, base64_body: &str, settings: &ImageSettings, ) -> Result<Solution>
pub fn solve_image_to_coordinates( &self, base64_body: &str, settings: &ImageToCoordinates, ) -> Result<Solution>
pub fn solve_recaptcha_v2(&self, settings: &RecaptchaV2) -> Result<Solution>
pub fn solve_recaptcha_v2_proxy_on( &self, settings: &RecaptchaV2, ) -> Result<Solution>
pub fn solve_recaptcha_v3(&self, settings: &RecaptchaV3) -> Result<Solution>
pub fn solve_hcaptcha(&self, settings: &HCaptcha) -> Result<Solution>
pub fn solve_hcaptcha_proxy_on(&self, settings: &HCaptcha) -> Result<Solution>
pub fn solve_funcaptcha(&self, settings: &FunCaptcha) -> Result<Solution>
pub fn solve_funcaptcha_proxy_on( &self, settings: &FunCaptcha, ) -> Result<Solution>
pub fn solve_geetest(&self, settings: &GeeTest) -> Result<Solution>
pub fn solve_geetest_proxy_on(&self, settings: &GeeTest) -> Result<Solution>
pub fn solve_turnstile(&self, settings: &Turnstile) -> Result<Solution>
pub fn solve_turnstile_proxy_on(&self, settings: &Turnstile) -> Result<Solution>
pub fn solve_prosopo(&self, settings: &Prosopo) -> Result<Solution>
pub fn solve_prosopo_proxy_on(&self, settings: &Prosopo) -> Result<Solution>
pub fn solve_friendly_captcha( &self, settings: &FriendlyCaptcha, ) -> Result<Solution>
pub fn solve_friendly_captcha_proxy_on( &self, settings: &FriendlyCaptcha, ) -> Result<Solution>
pub fn solve_altcha(&self, settings: &Altcha) -> Result<Solution>
pub fn solve_altcha_proxy_on(&self, settings: &Altcha) -> Result<Solution>
pub fn solve_amazon(&self, settings: &Amazon) -> Result<Solution>
pub fn solve_amazon_proxy_on(&self, settings: &Amazon) -> Result<Solution>
pub fn solve_antigate(&self, settings: &AntiGate) -> Result<Solution>
pub fn report_incorrect_image_captcha(&self, task_id: i64) -> Result<()>
pub fn report_incorrect_recaptcha(&self, task_id: i64) -> Result<()>
pub fn report_correct_recaptcha(&self, task_id: i64) -> Result<()>
pub fn report_incorrect_hcaptcha(&self, task_id: i64) -> Result<()>
Sourcepub fn solve_image_file(
&self,
path: impl AsRef<Path>,
settings: &ImageSettings,
) -> Result<Solution>
pub fn solve_image_file( &self, path: impl AsRef<Path>, settings: &ImageSettings, ) -> Result<Solution>
Solves an image captcha read from a file.
Sourcepub fn solve_image_to_coordinates_file(
&self,
path: impl AsRef<Path>,
settings: &ImageToCoordinates,
) -> Result<Solution>
pub fn solve_image_to_coordinates_file( &self, path: impl AsRef<Path>, settings: &ImageToCoordinates, ) -> Result<Solution>
Solves an image-to-coordinates captcha read from a file.
Sourcepub fn set_max_waiting_time(&mut self, timeout: Duration)
pub fn set_max_waiting_time(&mut self, timeout: Duration)
How long to keep polling before giving up. Default 300 seconds.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Client
impl !RefUnwindSafe for Client
impl !UnwindSafe for Client
impl Forget for Client
impl Move for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
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