Commit f6523719 authored by Florian Duguet's avatar Florian Duguet Committed by Romain Bignon

Manage funcaptcha

Add FuncaptchaQuestion and FuncaptchaJob to manage funcaptcha
parent fba92f46
......@@ -20,7 +20,7 @@
from time import sleep
from .base import Capability, BaseObject, StringField, UserError, BytesField
from ..exceptions import RecaptchaQuestion, NocaptchaQuestion, ImageCaptchaQuestion
from ..exceptions import RecaptchaQuestion, NocaptchaQuestion, FuncaptchaQuestion, ImageCaptchaQuestion
__all__ = [
......@@ -47,6 +47,12 @@ class NocaptchaJob(SolverJob):
site_key = StringField('Site key for NoCaptcha service')
class FuncaptchaJob(SolverJob):
site_url = StringField('Site URL for FunCaptcha service')
site_key = StringField('Site key for FunCaptcha service')
sub_domain = StringField('Required for some complex cases, but Funcaptcha integrations run without it')
class ImageCaptchaJob(SolverJob):
image = BytesField('data of the image to solve')
......@@ -76,6 +82,11 @@ def exception_to_job(exc):
job = NocaptchaJob()
job.site_url = exc.website_url
job.site_key = exc.website_key
elif isinstance(exc, FuncaptchaQuestion):
job = FuncaptchaJob()
job.site_url = exc.website_url
job.site_key = exc.website_key
job.sub_domain = exc.sub_domain
elif isinstance(exc, ImageCaptchaQuestion):
job = ImageCaptchaJob()
job.image = exc.image_data
......
......@@ -93,6 +93,18 @@ class RecaptchaQuestion(CaptchaQuestion):
super(RecaptchaQuestion, self).__init__(self.type, website_key=website_key, website_url=website_url)
class FuncaptchaQuestion(CaptchaQuestion):
type = 'funcaptcha'
website_key = None
website_url = None
sub_domain = None
def __init__(self, website_key, website_url, sub_domain=None):
super(FuncaptchaQuestion, self).__init__(
self.type, website_key=website_key, website_url=website_url, sub_domain=sub_domain)
class BrowserHTTPNotFound(BrowserUnavailable):
pass
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment