Commit e1535b69 authored by Romain Bignon's avatar Romain Bignon

captcha: little coding style improvement

parent f19f9d48
......@@ -133,7 +133,7 @@ class Amazon(LoginBrowser):
if not has_captcha:
raise BrowserIncorrectPassword()
else:
raise CaptchaQuestion(image_url=has_captcha, type="image_captcha")
raise CaptchaQuestion('image_captcha', image_url=has_captcha)
def location(self, *args, **kwargs):
"""
......
......@@ -67,7 +67,7 @@ class EdfBrowser(LoginBrowser):
if self.page.has_captcha_request():
website_key = self.page.get_recaptcha_key() # google recaptcha plubic key
website_url = "https://particulier.edf.fr/fr/accueil.html"
raise CaptchaQuestion(website_key=website_key, website_url=website_url, type="g_recaptcha")
raise CaptchaQuestion('g_recaptcha', website_key=website_key, website_url=website_url)
else:
raise BrowserIncorrectPassword()
else:
......
......@@ -46,12 +46,11 @@ class CaptchaQuestion(Exception):
"""
Handles captcha
"""
def __init__(self, website_key=None, website_url=None, image_url=None, type=None):
def __init__(self, type=None, **kwargs):
super(CaptchaQuestion, self).__init__("The site requires solving a captcha")
self.website_key = website_key
self.website_url = website_url
self.type = type
self.image_url = image_url
for key, value in kwargs.items():
setattr(self, key, value)
class BrowserHTTPNotFound(BrowserUnavailable):
......
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