weboob.capabilities.captcha

class weboob.capabilities.captcha.CapCaptchaSolver

Bases: weboob.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:CaptchaError
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
solve_catpcha_blocking(job)

Start a CAPTCHA solving job and wait for its solution

Parameters:job (SolverJob) – job to start and solve
Raises:CaptchaError
class weboob.capabilities.captcha.SolverJob(id=u'', url=NotLoaded, backend=None)

Bases: weboob.capabilities.base.BaseObject

Variables:solution – (unicode) CAPTCHA solution
class weboob.capabilities.captcha.RecaptchaJob(id=u'', url=NotLoaded, backend=None)

Bases: weboob.capabilities.captcha.SolverJob

Variables:
  • site_url – (unicode) Site URL for ReCaptcha service
  • site_key – (unicode) Site key for ReCaptcha service
  • solution_challenge – (unicode) Challenge ID of the solution (output value)
class weboob.capabilities.captcha.NocaptchaJob(id=u'', url=NotLoaded, backend=None)

Bases: weboob.capabilities.captcha.SolverJob

Variables:
  • site_url – (unicode) Site URL for NoCaptcha service
  • site_key – (unicode) Site key for NoCaptcha service
class weboob.capabilities.captcha.ImageCaptchaJob(id=u'', url=NotLoaded, backend=None)

Bases: weboob.capabilities.captcha.SolverJob

Variables:image – (str) data of the image to solve
exception weboob.capabilities.captcha.CaptchaError

Bases: weboob.capabilities.base.UserError

Generic solving error

exception weboob.capabilities.captcha.UnsolvableCaptcha

Bases: weboob.capabilities.captcha.CaptchaError

CAPTCHA is too hard or impossible

exception weboob.capabilities.captcha.InvalidCaptcha

Bases: weboob.capabilities.captcha.CaptchaError

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

exception weboob.capabilities.captcha.InsufficientFunds

Bases: weboob.capabilities.captcha.CaptchaError

Not enough funds to pay solution

weboob.capabilities.captcha.exception_to_job(exc)