woob.capabilities.captcha

class CapCaptchaSolver[source]

Bases: Capability

Provide CAPTCHA solving

RETRIES = 30
WAIT_TIME = 2
create_job(job)[source]

Start a CAPTCHA solving job

The job.id shall be filled. The CAPTCHA is not solved yet when the method returns.

Parameters:

job (SolverJob) – job to start

Raises:

NotImplementedError if CAPTCHA type is not supported

Raises:

CaptchaError in case of other error

poll_job(job)[source]

Check if a job was solved

If job is solved, return True and fill job.solution. Return False if solution is still pending. In case of solving problem, an exception may be raised.

It should not wait for the solution but return the current state.

Parameters:

job (SolverJob) – job to check and to fill when solved

Returns:

True if the job was solved

Return type:

bool

Raises:

CaptchaError

solve_captcha_blocking(job)[source]

Start a CAPTCHA solving job and wait for its solution

Parameters:

job (SolverJob) – job to start and solve

Raises:

CaptchaError

solve_catpcha_blocking(job)[source]

Typoed method that will disappear in an upcoming version

Return type:

SolverJob | None

report_wrong_solution(job)[source]

Report a solved job as a wrong solution

Sometimes, jobs are solved, but the solution is rejected by the CAPTCHA site because the solution is wrong. This method reports the solution as wrong to the CAPTCHA solver.

Parameters:

job (SolverJob) – job to flag

get_balance()[source]

Get the prepaid balance left

Return type:

float

class SolverJob(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Variables:
  • url – (str) url

  • solution – (str) CAPTCHA solution

class RecaptchaJob(id='', url=NotLoaded, backend=None)[source]

Bases: SolverJob

Variables:
  • url – (str) url

  • solution – (str) CAPTCHA solution

  • site_url – (str) Site URL for ReCaptcha service

  • site_key – (str) Site key for ReCaptcha service

  • solution_challenge – (str) Challenge ID of the solution (output value)

class RecaptchaV2Job(id='', url=NotLoaded, backend=None)[source]

Bases: SolverJob

Variables:
  • url – (str) url

  • solution – (str) CAPTCHA solution

  • site_url – (str) Site URL for NoCaptcha service

  • site_key – (str) Site key for NoCaptcha service

class RecaptchaV3Job(id='', url=NotLoaded, backend=None)[source]

Bases: SolverJob

Variables:
  • url – (str) url

  • solution – (str) CAPTCHA solution

  • site_url – (str) Site URL for ReCaptcha service

  • site_key – (str) Site key for ReCaptcha service

  • action – (str) Website owner defines what user is doing on the page through this parameter.

  • min_score – (float) Minimum score the reCaptcha response is required to have to be valid.

  • is_enterprise – (bool) If it is a reCaptcha enterprise

class ImageCaptchaJob(id='', url=NotLoaded, backend=None)[source]

Bases: SolverJob

Variables:
  • url – (str) url

  • solution – (str) CAPTCHA solution

  • image – (bytes) data of the image to solve

class HcaptchaJob(id='', url=NotLoaded, backend=None)[source]

Bases: SolverJob

Variables:
  • url – (str) url

  • solution – (str) CAPTCHA solution

  • site_url – (str) Site URL for HCaptcha service

  • site_key – (str) Site key for HCaptcha service

class GeetestV4Job(id='', url=NotLoaded, backend=None)[source]

Bases: SolverJob

Variables:
  • url – (str) url

  • solution – (str) CAPTCHA solution

  • site_url – (str) Site URL for Geetest service

  • gt – (str) Site domain public key

exception TurnstileQuestion(website_key, website_url)[source]

Bases: CaptchaQuestion

A Cloudflare Turnstile captcha has been encountered and requires resolution.

type = 'TurnstileTaskProxyless'
website_key = None
website_url = None
exception CaptchaError[source]

Bases: UserError

Generic solving error

exception UnsolvableCaptcha[source]

Bases: CaptchaError

CAPTCHA is too hard or impossible

exception InvalidCaptcha[source]

Bases: CaptchaError

CAPTCHA cannot be used (e.g. invalid image format)

exception InsufficientFunds[source]

Bases: CaptchaError

Not enough funds to pay solution

exception ImageCaptchaQuestion(image_data)[source]

Bases: CaptchaQuestion

The site signals to us that an image captcha should be solved.

type = 'image_captcha'
image_data = None
exception RecaptchaV2Question(website_key, website_url)[source]

Bases: CaptchaQuestion

The site signals to us that a recaptchav2 challenge should be solved.

type = 'g_recaptcha'
website_key = None
website_url = None
exception RecaptchaQuestion(website_key, website_url)[source]

Bases: CaptchaQuestion

The site signals to us that a recaptcha challenge should be solved.

type = 'g_recaptcha'
website_key = None
website_url = None
exception GeetestV4Question(website_url, gt)[source]

Bases: CaptchaQuestion

The site signals to us that a geetestv4 challenge should be solved.

type = 'GeeTestTaskProxyless'
website_url = None
gt = None
exception RecaptchaV3Question(website_key, website_url, action=None, min_score=None, is_enterprise=False)[source]

Bases: CaptchaQuestion

The site signals to us that a recaptchav3 challenge should be solved.

type = 'g_recaptcha'
website_key = None
website_url = None
action = None
min_score = None
is_enterprise = False
exception FuncaptchaQuestion(website_key, website_url, sub_domain=None, data=None)[source]

Bases: CaptchaQuestion

The site signals to us that a Funcaptcha challenge should be solved.

type = 'funcaptcha'
website_key = None
website_url = None
sub_domain = None
data = None

Optional additional data, as a dictionary.

For example, a site could transmit a ‘blob’ property which you should get, and transmit as {‘blob’: your_blob_value} through this property.

exception HcaptchaQuestion(website_key, website_url)[source]

Bases: CaptchaQuestion

The site signals to us that an HCaptcha challenge should be solved.

type = 'hcaptcha'
website_key = None
website_url = None
exception_to_job(exc)[source]