Commit d32c4327 authored by Vincent A's avatar Vincent A

core: rename Nocaptcha* to RecaptchaV2* as it's more accurate

"No captcha" was the nickname of RecaptchaV2 service, but it's confusing
and less precise. Rename and keep compatibility.
parent 7c30bb26
......@@ -18,17 +18,19 @@
# along with weboob. If not, see <>.
from time import sleep
import warnings
from .base import Capability, BaseObject, StringField, UserError, BytesField
from ..exceptions import (
RecaptchaQuestion, RecaptchaV3Question, NocaptchaQuestion, FuncaptchaQuestion,
RecaptchaQuestion, RecaptchaV3Question, RecaptchaV2Question, FuncaptchaQuestion,
ImageCaptchaQuestion, HcaptchaQuestion,
__all__ = [
'SolverJob', 'RecaptchaJob', 'NocaptchaJob', 'ImageCaptchaJob', 'HcaptchaJob',
'SolverJob', 'RecaptchaJob', 'RecaptchaV2Job', 'RecaptchaV3Job',
'ImageCaptchaJob', 'HcaptchaJob',
'CaptchaError', 'UnsolvableCaptcha', 'InvalidCaptcha', 'InsufficientFunds',
......@@ -51,11 +53,17 @@ class RecaptchaV3Job(SolverJob):
action = StringField('Website owner defines what user is doing on the page through this parameter.')
class NocaptchaJob(SolverJob):
class RecaptchaV2Job(SolverJob):
site_url = StringField('Site URL for NoCaptcha service')
site_key = StringField('Site key for NoCaptcha service')
class NocaptchaJob(RecaptchaV2Job):
def __init__(self, *args, **kwargs):
warnings.warn('use RecaptchaV2Job class instead', DeprecationWarning)
super(NocaptchaJob, self).__init__(*args, **kwargs)
class FuncaptchaJob(SolverJob):
site_url = StringField('Site URL for FunCaptcha service')
site_key = StringField('Site key for FunCaptcha service')
......@@ -97,8 +105,8 @@ def exception_to_job(exc):
job.site_url = exc.website_url
job.site_key = exc.website_key
job.action = exc.action
elif isinstance(exc, NocaptchaQuestion):
job = NocaptchaJob()
elif isinstance(exc, RecaptchaV2Question):
job = RecaptchaV2Job()
job.site_url = exc.website_url
job.site_key = exc.website_key
elif isinstance(exc, FuncaptchaQuestion):
......@@ -17,6 +17,7 @@
# You should have received a copy of the GNU Lesser General Public License
# along with weboob. If not, see <>.
import warnings
from import to_unicode
from import StrConv
......@@ -127,14 +128,20 @@ class ImageCaptchaQuestion(CaptchaQuestion):
super(ImageCaptchaQuestion, self).__init__(self.type, image_data=image_data)
class NocaptchaQuestion(CaptchaQuestion):
class RecaptchaV2Question(CaptchaQuestion):
type = 'g_recaptcha'
website_key = None
website_url = None
def __init__(self, website_key, website_url):
super(NocaptchaQuestion, self).__init__(self.type, website_key=website_key, website_url=website_url)
super(RecaptchaV2Question, self).__init__(self.type, website_key=website_key, website_url=website_url)
class NocaptchaQuestion(RecaptchaV2Question):
def __init__(self, *args, **kwargs):
warnings.warn('use RecaptchaV2Question class instead', DeprecationWarning)
super(NocaptchaQuestion, self).__init__(*args, **kwargs)
class RecaptchaQuestion(CaptchaQuestion):
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