cleanup
This commit is contained in:
parent
ee4f3793a1
commit
9f9f8edc01
3 changed files with 9 additions and 24 deletions
|
|
@ -42,8 +42,9 @@ class BoursoramaBackend(BaseBackend, ICapBank):
|
|||
DESCRIPTION = u'Boursorama French bank website'
|
||||
CONFIG = BackendConfig(ValueBackendPassword('login', label='Account ID', masked=False),
|
||||
ValueBackendPassword('password', label='Password'),
|
||||
ValueBool('enable_twofactors', label='Send validation sms', default=False),
|
||||
Value('device', label='Device name', regexp='\w*'),)
|
||||
ValueBool('enable_twofactors', label='Send validation sms', default=False),
|
||||
Value('device', label='Device name', regexp='\w*', default=''),
|
||||
)
|
||||
BROWSER = Boursorama
|
||||
|
||||
def create_default_browser(self):
|
||||
|
|
|
|||
|
|
@ -61,9 +61,10 @@ class Boursorama(BaseBrowser):
|
|||
if self.enable_twofactors:
|
||||
self.page.authenticate(self.device)
|
||||
else:
|
||||
print \
|
||||
"""Boursorama - activate the two factor authentication in boursorama config."""\
|
||||
""" You will receive SMS code but are limited in request per day (around 15)"""
|
||||
raise BrowserIncorrectAuthenticationCode(
|
||||
"""Boursorama - activate the two factor authentication in boursorama config."""\
|
||||
""" You will receive SMS code but are limited in request per day (around 15)"""
|
||||
)
|
||||
|
||||
def login(self):
|
||||
assert isinstance(self.username, basestring)
|
||||
|
|
@ -72,9 +73,6 @@ class Boursorama(BaseBrowser):
|
|||
assert isinstance(self.enable_twofactors, bool)
|
||||
assert self.password.isdigit()
|
||||
|
||||
#for debug, save requested pages to tmp dir
|
||||
#self.SAVE_RESPONSES = True
|
||||
|
||||
if not self.is_on_page(LoginPage):
|
||||
self.location('https://' + self.DOMAIN + '/connexion.phtml')
|
||||
|
||||
|
|
@ -93,12 +91,8 @@ class Boursorama(BaseBrowser):
|
|||
#if the login was correct but authentication code failed,
|
||||
#we need to verify if bourso redirect us to login page or authentication page
|
||||
if self.is_on_page(LoginPage):
|
||||
#print "not correct after handling authentication"
|
||||
raise BrowserIncorrectAuthenticationCode()
|
||||
|
||||
#print "login over"
|
||||
|
||||
|
||||
def get_accounts_list(self):
|
||||
if not self.is_on_page(AccountsList):
|
||||
self.location('/comptes/synthese.phtml')
|
||||
|
|
|
|||
|
|
@ -22,20 +22,15 @@ from weboob.tools.browser import BasePage, BrowserIncorrectPassword
|
|||
import urllib2
|
||||
import re
|
||||
|
||||
|
||||
__all__ = ['AuthenticationPage']
|
||||
|
||||
|
||||
class BrowserAuthenticationCodeMaxLimit(BrowserIncorrectPassword):
|
||||
pass
|
||||
|
||||
def write_debug(string, fi):
|
||||
f = open(fi, "w")
|
||||
f.write(string)
|
||||
|
||||
|
||||
class AuthenticationPage(BasePage):
|
||||
|
||||
|
||||
MAX_LIMIT = "vous avez atteint le nombre maximum "\
|
||||
"d'utilisation de l'authentification forte."
|
||||
|
||||
|
|
@ -81,12 +76,10 @@ class AuthenticationPage(BasePage):
|
|||
#extrat authentication token from response (in form)
|
||||
info = response.read()
|
||||
|
||||
#write_debug(info, "step1.html")
|
||||
|
||||
regex = re.compile(r"vous avez atteint le nombre maximum d'utilisation de l'authentification forte.")
|
||||
r = regex.search(info)
|
||||
if r:
|
||||
print "Boursorama - Vous avez atteint le nombre maximum d'utilisation de l'authentification forte"
|
||||
self.logger.info("Boursorama - Vous avez atteint le nombre maximum d'utilisation de l'authentification forte")
|
||||
raise BrowserAuthenticationCodeMaxLimit()
|
||||
|
||||
#print "Response from initial request,", len(info), response.info()
|
||||
|
|
@ -105,7 +98,6 @@ class AuthenticationPage(BasePage):
|
|||
#info = response.read()
|
||||
#print "after asking to send token authentification" \
|
||||
# ,len(info), response.info()
|
||||
#write_debug(info, "step2.html")
|
||||
|
||||
#self.print_cookies()
|
||||
|
||||
|
|
@ -117,7 +109,6 @@ class AuthenticationPage(BasePage):
|
|||
response = self.browser.open(req)
|
||||
#info = response.read()
|
||||
#print "after pin authentification", len(info), response.info()
|
||||
#write_debug(info, "step3.html")
|
||||
|
||||
#self.print_cookies()
|
||||
|
||||
|
|
@ -128,7 +119,6 @@ class AuthenticationPage(BasePage):
|
|||
|
||||
#result = response.read()
|
||||
#print response, "\n", response.info()
|
||||
#write_debug(result, "step4.html")
|
||||
|
||||
#self.print_cookies()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue