woob.capabilities.captcha
¶
-
class
woob.capabilities.captcha.
CapCaptchaSolver
¶ Bases:
woob.capabilities.base.Capability
Provide CAPTCHA solving
-
RETRIES
= 30¶
-
WAIT_TIME
= 2¶
-
create_job
(job)¶ 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
-
get_balance
()¶ Get the prepaid balance left
- Return type
float
-
poll_job
(job)¶ 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
-
report_wrong_solution
(job)¶ 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
-
-
exception
woob.capabilities.captcha.
CaptchaError
¶ Bases:
woob.capabilities.base.UserError
Generic solving error
-
class
woob.capabilities.captcha.
HcaptchaJob
(id='', url=NotLoaded, backend=None)¶ Bases:
woob.capabilities.captcha.SolverJob
- Variables
site_url – (
str
) Site URL for HCaptcha servicesite_key – (
str
) Site key for HCaptcha service
-
class
woob.capabilities.captcha.
ImageCaptchaJob
(id='', url=NotLoaded, backend=None)¶ Bases:
woob.capabilities.captcha.SolverJob
- Variables
image – (
bytes
) data of the image to solve
-
exception
woob.capabilities.captcha.
InsufficientFunds
¶ Bases:
woob.capabilities.captcha.CaptchaError
Not enough funds to pay solution
-
exception
woob.capabilities.captcha.
InvalidCaptcha
¶ Bases:
woob.capabilities.captcha.CaptchaError
CAPTCHA cannot be used (e.g. invalid image format)
-
class
woob.capabilities.captcha.
RecaptchaJob
(id='', url=NotLoaded, backend=None)¶ Bases:
woob.capabilities.captcha.SolverJob
- Variables
site_url – (
str
) Site URL for ReCaptcha servicesite_key – (
str
) Site key for ReCaptcha servicesolution_challenge – (
str
) Challenge ID of the solution (output value)
-
class
woob.capabilities.captcha.
RecaptchaV2Job
(id='', url=NotLoaded, backend=None)¶ Bases:
woob.capabilities.captcha.SolverJob
- Variables
site_url – (
str
) Site URL for NoCaptcha servicesite_key – (
str
) Site key for NoCaptcha service
-
class
woob.capabilities.captcha.
RecaptchaV3Job
(id='', url=NotLoaded, backend=None)¶ Bases:
woob.capabilities.captcha.SolverJob
- Variables
site_url – (
str
) Site URL for ReCaptcha servicesite_key – (
str
) Site key for ReCaptcha serviceaction – (
str
) Website owner defines what user is doing on the page through this parameter.
-
class
woob.capabilities.captcha.
SolverJob
(id='', url=NotLoaded, backend=None)¶ Bases:
woob.capabilities.base.BaseObject
- Variables
solution – (
str
) CAPTCHA solution
-
exception
woob.capabilities.captcha.
UnsolvableCaptcha
¶ Bases:
woob.capabilities.captcha.CaptchaError
CAPTCHA is too hard or impossible
-
woob.capabilities.captcha.
exception_to_job
(exc)¶