From 83d4d4015b42a1bf2f57b83779170b3c61d7377f Mon Sep 17 00:00:00 2001 From: Vincent A Date: Sat, 2 Jan 2021 19:09:09 +0100 Subject: [PATCH] modules: use RecaptchaV2 names --- modules/anticaptcha/browser.py | 4 ++-- modules/anticaptcha/module.py | 6 +++--- modules/carrefourbanque/browser.py | 4 ++-- modules/cityscoot/browser.py | 4 ++-- modules/deathbycaptcha/browser.py | 2 +- modules/deathbycaptcha/module.py | 6 +++--- modules/ldlc/browser.py | 4 ++-- modules/materielnet/browser.py | 4 ++-- modules/myedenred/browser.py | 4 ++-- modules/swile/browser.py | 4 ++-- 10 files changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/anticaptcha/browser.py b/modules/anticaptcha/browser.py index d7ad327ff1..bf76baafb1 100644 --- a/modules/anticaptcha/browser.py +++ b/modules/anticaptcha/browser.py @@ -24,7 +24,7 @@ from weboob.browser.browsers import APIBrowser from weboob.exceptions import BrowserIncorrectPassword, BrowserBanned from weboob.capabilities.captcha import ( - ImageCaptchaJob, RecaptchaJob, RecaptchaV3Job, NocaptchaJob, FuncaptchaJob, HcaptchaJob, + ImageCaptchaJob, RecaptchaJob, RecaptchaV3Job, RecaptchaV2Job, FuncaptchaJob, HcaptchaJob, CaptchaError, InsufficientFunds, UnsolvableCaptcha, InvalidCaptcha, ) @@ -150,7 +150,7 @@ def poll(self, job): elif isinstance(job, RecaptchaJob): job.solution = sol['recaptchaResponse'] job.solution_challenge = sol['recaptchaChallenge'] - elif isinstance(job, (NocaptchaJob, RecaptchaV3Job, HcaptchaJob)): + elif isinstance(job, (RecaptchaV2Job, RecaptchaV3Job, HcaptchaJob)): job.solution = sol['gRecaptchaResponse'] elif isinstance(job, FuncaptchaJob): job.solution = sol['token'] diff --git a/modules/anticaptcha/module.py b/modules/anticaptcha/module.py index 7ab963b557..d8f7015f40 100644 --- a/modules/anticaptcha/module.py +++ b/modules/anticaptcha/module.py @@ -22,7 +22,7 @@ from weboob.tools.backend import Module, BackendConfig from weboob.capabilities.captcha import ( - CapCaptchaSolver, ImageCaptchaJob, RecaptchaJob, RecaptchaV3Job, NocaptchaJob, FuncaptchaJob, + CapCaptchaSolver, ImageCaptchaJob, RecaptchaJob, RecaptchaV3Job, RecaptchaV2Job, FuncaptchaJob, HcaptchaJob, ) from weboob.tools.value import ValueBackendPassword @@ -58,7 +58,7 @@ def create_job(self, job): job.id = self.browser.post_recaptcha(job.site_url, job.site_key) elif isinstance(job, RecaptchaV3Job): job.id = self.browser.post_gcaptchav3(job.site_url, job.site_key, job.action) - elif isinstance(job, NocaptchaJob): + elif isinstance(job, RecaptchaV2Job): job.id = self.browser.post_nocaptcha(job.site_url, job.site_key) elif isinstance(job, FuncaptchaJob): job.id = self.browser.post_funcaptcha(job.site_url, job.site_key, job.sub_domain) @@ -73,7 +73,7 @@ def poll_job(self, job): def report_wrong_solution(self, job): if isinstance(job, ImageCaptchaJob): self.browser.report_wrong_image(job) - if isinstance(job, (NocaptchaJob, RecaptchaJob, RecaptchaV3Job)): + if isinstance(job, (RecaptchaV2Job, RecaptchaJob, RecaptchaV3Job)): self.browser.report_wrong_recaptcha(job) def get_balance(self): diff --git a/modules/carrefourbanque/browser.py b/modules/carrefourbanque/browser.py index c2531a45ba..b5be98d7c8 100644 --- a/modules/carrefourbanque/browser.py +++ b/modules/carrefourbanque/browser.py @@ -22,7 +22,7 @@ from time import sleep from weboob.browser import LoginBrowser, URL, need_login, StatesMixin -from weboob.exceptions import BrowserIncorrectPassword, NocaptchaQuestion, BrowserUnavailable +from weboob.exceptions import BrowserIncorrectPassword, RecaptchaV2Question, BrowserUnavailable from weboob.capabilities.bank import Account from weboob.tools.compat import basestring @@ -102,7 +102,7 @@ def do_login(self): # cookie session is not available website_key = self.page.get_recaptcha_site_key() website_url = self.login.build() - raise NocaptchaQuestion(website_key=website_key, website_url=website_url) + raise RecaptchaV2Question(website_key=website_key, website_url=website_url) else: # we got javascript page again, this shouldn't happen assert False, "obfuscated javascript not managed" diff --git a/modules/cityscoot/browser.py b/modules/cityscoot/browser.py index dff38a4a00..1537c0d038 100644 --- a/modules/cityscoot/browser.py +++ b/modules/cityscoot/browser.py @@ -21,7 +21,7 @@ from weboob.browser import LoginBrowser, URL, need_login -from weboob.exceptions import BrowserIncorrectPassword, NocaptchaQuestion +from weboob.exceptions import BrowserIncorrectPassword, RecaptchaV2Question from .pages import LoginPage, SubscriptionsPage, DocumentsPage, OtpPage @@ -47,7 +47,7 @@ def do_login(self): self.login.go() if self.page.has_captcha() and self.config['captcha_response'].get() is None: website_key = self.page.get_captcha_key() - raise NocaptchaQuestion(website_key=website_key, website_url=self.url) + raise RecaptchaV2Question(website_key=website_key, website_url=self.url) else: self.page.login(self.username, self.password, self.config['captcha_response'].get()) diff --git a/modules/deathbycaptcha/browser.py b/modules/deathbycaptcha/browser.py index 65d6b62e70..1a584b1446 100644 --- a/modules/deathbycaptcha/browser.py +++ b/modules/deathbycaptcha/browser.py @@ -64,7 +64,7 @@ def create_job(self, data): return reply['captcha'] - def create_nocaptcha_job(self, url, key): + def create_recaptcha2_job(self, url, key): token_params = { 'googlekey': key, diff --git a/modules/deathbycaptcha/module.py b/modules/deathbycaptcha/module.py index 6b3e6cd237..9b3d967843 100644 --- a/modules/deathbycaptcha/module.py +++ b/modules/deathbycaptcha/module.py @@ -21,7 +21,7 @@ from weboob.tools.backend import Module, BackendConfig from weboob.tools.value import ValueBackendPassword, Value -from weboob.capabilities.captcha import CapCaptchaSolver, ImageCaptchaJob, NocaptchaJob +from weboob.capabilities.captcha import CapCaptchaSolver, ImageCaptchaJob, RecaptchaV2Job from .browser import DeathbycaptchaBrowser @@ -50,8 +50,8 @@ def create_default_browser(self): def create_job(self, job): if isinstance(job, ImageCaptchaJob): job.id = self.browser.create_job(job.image) - elif isinstance(job, NocaptchaJob): # or RecaptchaV2 - job.id = self.browser.create_nocaptcha_job(job.site_url, job.site_key) + elif isinstance(job, RecaptchaV2Job): + job.id = self.browser.create_recaptcha2_job(job.site_url, job.site_key) else: raise NotImplementedError() diff --git a/modules/ldlc/browser.py b/modules/ldlc/browser.py index a6e0b74b47..8ce8718bec 100644 --- a/modules/ldlc/browser.py +++ b/modules/ldlc/browser.py @@ -18,7 +18,7 @@ # along with this weboob module. If not, see . from weboob.browser import LoginBrowser, AbstractBrowser, URL, need_login -from weboob.exceptions import BrowserIncorrectPassword, NocaptchaQuestion +from weboob.exceptions import BrowserIncorrectPassword, RecaptchaV2Question from .pages import HomePage, LoginPage, ProBillsPage, DocumentsPage @@ -56,7 +56,7 @@ def do_login(self): self.login.stay_or_go() sitekey = self.page.get_recaptcha_sitekey() if sitekey and not self.config['captcha_response'].get(): - raise NocaptchaQuestion(website_key=sitekey, website_url=self.login.build()) + raise RecaptchaV2Question(website_key=sitekey, website_url=self.login.build()) self.page.login(self.username, self.password, self.config['captcha_response'].get()) diff --git a/modules/materielnet/browser.py b/modules/materielnet/browser.py index 9c6cd37dc3..a19dbbee1a 100644 --- a/modules/materielnet/browser.py +++ b/modules/materielnet/browser.py @@ -21,7 +21,7 @@ from weboob.browser import LoginBrowser, URL, need_login -from weboob.exceptions import BrowserIncorrectPassword, NocaptchaQuestion +from weboob.exceptions import BrowserIncorrectPassword, RecaptchaV2Question from .pages import LoginPage, CaptchaPage, ProfilePage, DocumentsPage, DocumentsDetailsPage @@ -64,7 +64,7 @@ def do_login(self): # captcha is not always present if sitekey: if not self.config['captcha_response'].get(): - raise NocaptchaQuestion(website_key=sitekey, website_url=self.login.build(lang=self.lang)) + raise RecaptchaV2Question(website_key=sitekey, website_url=self.login.build(lang=self.lang)) self.page.login(self.username, self.password, self.config['captcha_response'].get()) diff --git a/modules/myedenred/browser.py b/modules/myedenred/browser.py index 8ef55919c2..feca079932 100644 --- a/modules/myedenred/browser.py +++ b/modules/myedenred/browser.py @@ -24,7 +24,7 @@ from functools import wraps from weboob.browser import URL, OAuth2PKCEMixin, PagesBrowser -from weboob.exceptions import BrowserIncorrectPassword, NocaptchaQuestion, WrongCaptchaResponse, ActionNeeded +from weboob.exceptions import BrowserIncorrectPassword, RecaptchaV2Question, WrongCaptchaResponse, ActionNeeded from weboob.browser.exceptions import ServerError, ClientError, BrowserUnavailable from weboob.tools.decorators import retry @@ -117,7 +117,7 @@ def request_authorization(self): website_key = self.page.get_recaptcha_site_key() if not self.config['captcha_response'].get() and website_key: - raise NocaptchaQuestion(website_key=website_key, website_url=self.url) + raise RecaptchaV2Question(website_key=website_key, website_url=self.url) form = self.page.get_login_form() form['Username'] = self.username diff --git a/modules/swile/browser.py b/modules/swile/browser.py index 86e67ed569..efff7d4f6b 100644 --- a/modules/swile/browser.py +++ b/modules/swile/browser.py @@ -31,7 +31,7 @@ from weboob.capabilities.base import empty from weboob.browser.filters.json import Dict from weboob.browser.exceptions import ClientError, BrowserTooManyRequests -from weboob.exceptions import BrowserIncorrectPassword, NocaptchaQuestion +from weboob.exceptions import BrowserIncorrectPassword, RecaptchaV2Question from weboob.browser.browsers import APIBrowser, OAuth2Mixin from weboob.capabilities.bank import Account, Transaction @@ -72,7 +72,7 @@ def request_authorization(self): # if the captcha's response is not completed the error is # 426 Client Error: Upgrade Required if e.response.status_code == 426 and not self.config['captcha_response'].get(): - raise NocaptchaQuestion(website_url='https://app.swile.co/signin', website_key='6LceI-EUAAAAACrBsmKCmllNdk1-H5U7G7NOTzmj') + raise RecaptchaV2Question(website_url='https://app.swile.co/signin', website_key='6LceI-EUAAAAACrBsmKCmllNdk1-H5U7G7NOTzmj') if e.response.status_code == 400: json = e.response.json() message = json['error_description'] -- GitLab