Commit 83d4d401 authored by Vincent A's avatar Vincent A

modules: use RecaptchaV2 names

parent d32c4327
......@@ -24,7 +24,7 @@ from base64 import b64encode
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 @@ class AnticaptchaBrowser(APIBrowser):
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']
......
......@@ -22,7 +22,7 @@ from __future__ import unicode_literals
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 @@ class AnticaptchaModule(Module, CapCaptchaSolver):
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 @@ class AnticaptchaModule(Module, CapCaptchaSolver):
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):
......
......@@ -22,7 +22,7 @@ from __future__ import absolute_import, unicode_literals
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 @@ class CarrefourBanqueBrowser(LoginBrowser, StatesMixin):
# 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"
......
......@@ -21,7 +21,7 @@ from __future__ import unicode_literals
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 @@ class CityscootBrowser(LoginBrowser):
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())
......
......@@ -64,7 +64,7 @@ class DeathbycaptchaBrowser(DomainBrowser):
return reply['captcha']
def create_nocaptcha_job(self, url, key):
def create_recaptcha2_job(self, url, key):
token_params = {
'googlekey': key,
......
......@@ -21,7 +21,7 @@ from __future__ import unicode_literals
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 @@ class DeathbycaptchaModule(Module, CapCaptchaSolver):
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()
......
......@@ -18,7 +18,7 @@
# along with this weboob module. If not, see <http://www.gnu.org/licenses/>.
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 @@ class LdlcBrowser(LoginBrowser):
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())
......
......@@ -21,7 +21,7 @@ from __future__ import unicode_literals
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 @@ class MaterielnetBrowser(LoginBrowser):
# 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())
......
......@@ -24,7 +24,7 @@ from __future__ import unicode_literals
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 @@ class MyedenredBrowser(OAuth2PKCEMixin, PagesBrowser):
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
......
......@@ -31,7 +31,7 @@ from weboob.browser.filters.standard import (
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 @@ class SwileBrowser(OAuth2Mixin, APIBrowser):
# 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']
......
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