Pep8 cleaning
This commit is contained in:
parent
4a327e153e
commit
5b6e475428
4 changed files with 34 additions and 24 deletions
|
|
@ -21,8 +21,10 @@
|
||||||
# python2.5 compatibility
|
# python2.5 compatibility
|
||||||
from __future__ import with_statement
|
from __future__ import with_statement
|
||||||
|
|
||||||
from weboob.capabilities.bank import ICapBank, AccountNotFound, Account, Recipient
|
from weboob.capabilities.bank import ICapBank, AccountNotFound,\
|
||||||
from weboob.capabilities.bill import ICapBill, Bill, Subscription, SubscriptionNotFound, BillNotFound
|
Account, Recipient
|
||||||
|
from weboob.capabilities.bill import ICapBill, Bill, Subscription,\
|
||||||
|
SubscriptionNotFound, BillNotFound
|
||||||
from weboob.tools.backend import BaseBackend, BackendConfig
|
from weboob.tools.backend import BaseBackend, BackendConfig
|
||||||
from weboob.tools.value import ValueBackendPassword
|
from weboob.tools.value import ValueBackendPassword
|
||||||
|
|
||||||
|
|
@ -56,7 +58,6 @@ class INGBackend(BaseBackend, ICapBank, ICapBill):
|
||||||
self.config['password'].get(),
|
self.config['password'].get(),
|
||||||
birthday=self.config['birthday'].get())
|
birthday=self.config['birthday'].get())
|
||||||
|
|
||||||
|
|
||||||
def iter_resources(self, objs, split_path):
|
def iter_resources(self, objs, split_path):
|
||||||
if Account in objs:
|
if Account in objs:
|
||||||
self._restrict_level(split_path)
|
self._restrict_level(split_path)
|
||||||
|
|
|
||||||
|
|
@ -48,12 +48,18 @@ class Ing(BaseBrowser):
|
||||||
}
|
}
|
||||||
CERTHASH = "fba557b387cccc3d71ba038f9ef1de4d71541d7954744c79f6a7ff5f3cd4dc12"
|
CERTHASH = "fba557b387cccc3d71ba038f9ef1de4d71541d7954744c79f6a7ff5f3cd4dc12"
|
||||||
|
|
||||||
|
loginpage = '/public/displayLogin.jsf'
|
||||||
|
accountspage = '/general?command=displayTRAccountSummary'
|
||||||
|
transferpage = '/protected/pages/cc/transfer/transferManagement.jsf'
|
||||||
|
dotransferpage = '/general?command=DisplayDoTransferCommand'
|
||||||
|
valtransferpage = '/protected/pages/cc/transfer/create/transferCreateValidation.jsf'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
self.birthday = kwargs.pop('birthday', None)
|
self.birthday = kwargs.pop('birthday', None)
|
||||||
BaseBrowser.__init__(self, *args, **kwargs)
|
BaseBrowser.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
def home(self):
|
def home(self):
|
||||||
self.location('https://secure.ingdirect.fr/public/displayLogin.jsf')
|
self.location(self.loginpage)
|
||||||
|
|
||||||
def is_logged(self):
|
def is_logged(self):
|
||||||
return not self.is_on_page(LoginPage)
|
return not self.is_on_page(LoginPage)
|
||||||
|
|
@ -66,8 +72,7 @@ class Ing(BaseBrowser):
|
||||||
assert self.birthday.isdigit()
|
assert self.birthday.isdigit()
|
||||||
|
|
||||||
if not self.is_on_page(LoginPage):
|
if not self.is_on_page(LoginPage):
|
||||||
self.location('https://secure.ingdirect.fr/\
|
self.location(self.loginpage)
|
||||||
public/displayLogin.jsf')
|
|
||||||
|
|
||||||
self.page.prelogin(self.username, self.birthday)
|
self.page.prelogin(self.username, self.birthday)
|
||||||
self.page.login(self.password)
|
self.page.login(self.password)
|
||||||
|
|
@ -76,7 +81,7 @@ class Ing(BaseBrowser):
|
||||||
|
|
||||||
def get_accounts_list(self):
|
def get_accounts_list(self):
|
||||||
if not self.is_on_page(AccountsList):
|
if not self.is_on_page(AccountsList):
|
||||||
self.location('/general?command=displayTRAccountSummary')
|
self.location(self.accountspage)
|
||||||
|
|
||||||
return self.page.get_list()
|
return self.page.get_list()
|
||||||
|
|
||||||
|
|
@ -84,7 +89,7 @@ class Ing(BaseBrowser):
|
||||||
assert isinstance(id, basestring)
|
assert isinstance(id, basestring)
|
||||||
|
|
||||||
if not self.is_on_page(AccountsList):
|
if not self.is_on_page(AccountsList):
|
||||||
self.location('/general?command=displayTRAccountSummary')
|
self.location(self.accountspage)
|
||||||
|
|
||||||
l = self.page.get_list()
|
l = self.page.get_list()
|
||||||
for a in l:
|
for a in l:
|
||||||
|
|
@ -103,11 +108,13 @@ class Ing(BaseBrowser):
|
||||||
account = self.get_account(account)
|
account = self.get_account(account)
|
||||||
# The first and the second letter of the label are the account type
|
# The first and the second letter of the label are the account type
|
||||||
if account.label[0:2] == "CC":
|
if account.label[0:2] == "CC":
|
||||||
self.location('https://secure.ingdirect.fr/protected/pages/cc/accountDetail.jsf?account=%s' % int(account._index))
|
self.location('/protected/pages/cc/accountDetail.jsf?account=%s'
|
||||||
|
% int(account._index))
|
||||||
elif account.label[0:2] == "LA" or account.label[0:3] == "LEO":
|
elif account.label[0:2] == "LA" or account.label[0:3] == "LEO":
|
||||||
# we want "displayTRHistoriqueLA" but this fucking page
|
# we want "displayTRHistoriqueLA" but this fucking page
|
||||||
# is not directly available...
|
# is not directly available...
|
||||||
self.location('https://secure.ingdirect.fr/general?command=goToAccount&account=%d&zone=COMPTE' % int(account._index))
|
self.location('/general?command=goToAccount&account=%d&zone=COMPTE'
|
||||||
|
% int(account._index))
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
while 1:
|
while 1:
|
||||||
|
|
@ -120,19 +127,20 @@ class Ing(BaseBrowser):
|
||||||
if self.page.islast():
|
if self.page.islast():
|
||||||
return
|
return
|
||||||
|
|
||||||
# XXX server sends an unknown mimetype, we overload viewing_html() above to
|
# XXX server sends an unknown mimetype, we overload
|
||||||
# prevent this issue.
|
# viewing_html() above to prevent this issue.
|
||||||
self.page.next_page()
|
self.page.next_page()
|
||||||
|
|
||||||
def get_recipients(self, account):
|
def get_recipients(self, account):
|
||||||
if not self.is_on_page(TransferPage):
|
if not self.is_on_page(TransferPage):
|
||||||
self.location('https://secure.ingdirect.fr/protected/pages/cc/transfer/transferManagement.jsf')
|
self.location(self.transferpage)
|
||||||
if self.page.ischecked(account):
|
if self.page.ischecked(account):
|
||||||
return self.page.get_recipients()
|
return self.page.get_recipients()
|
||||||
else:
|
else:
|
||||||
# It is hard to check the box and to get the real list. We try an alternative way like normal users
|
# It is hard to check the box and to get the real list.
|
||||||
|
# We try an alternative way like normal users
|
||||||
self.get_history(account.id).next()
|
self.get_history(account.id).next()
|
||||||
self.location('https://secure.ingdirect.fr/general?command=DisplayDoTransferCommand')
|
self.location(self.dotransferpage)
|
||||||
return self.page.get_recipients()
|
return self.page.get_recipients()
|
||||||
|
|
||||||
def transfer(self, account, recipient, amount, reason):
|
def transfer(self, account, recipient, amount, reason):
|
||||||
|
|
@ -146,25 +154,26 @@ class Ing(BaseBrowser):
|
||||||
recipient = destination
|
recipient = destination
|
||||||
break
|
break
|
||||||
if found:
|
if found:
|
||||||
self.openurl('/protected/pages/cc/transfer/transferManagement.jsf', self.page.buildonclick(recipient, account))
|
self.openurl(self.transferpage,
|
||||||
|
self.page.buildonclick(recipient, account))
|
||||||
self.page.transfer(recipient, amount, reason)
|
self.page.transfer(recipient, amount, reason)
|
||||||
self.location('/protected/pages/cc/transfer/create/transferCreateValidation.jsf')
|
self.location(self.valtransferpage)
|
||||||
if not self.is_on_page(TransferConfirmPage):
|
if not self.is_on_page(TransferConfirmPage):
|
||||||
raise TransferError("Invalid transfer (no confirmation page)")
|
raise TransferError("Invalid transfer (no confirmation page)")
|
||||||
else:
|
else:
|
||||||
self.page.confirm(self.password)
|
self.page.confirm(self.password)
|
||||||
self.location('/protected/pages/cc/transfer/create/transferCreateValidation.jsf')
|
self.location(self.valtransferpage)
|
||||||
return self.page.recap()
|
return self.page.recap()
|
||||||
else:
|
else:
|
||||||
raise TransferError('Recipient not found')
|
raise TransferError('Recipient not found')
|
||||||
|
|
||||||
def get_subscriptions(self):
|
def get_subscriptions(self):
|
||||||
self.location('https://secure.ingdirect.fr/protected/pages/common/estatement/eStatement.jsf')
|
self.location('/protected/pages/common/estatement/eStatement.jsf')
|
||||||
return self.page.iter_account()
|
return self.page.iter_account()
|
||||||
|
|
||||||
def get_bills(self, subscription):
|
def get_bills(self, subscription):
|
||||||
if not self.is_on_page(BillsPage):
|
if not self.is_on_page(BillsPage):
|
||||||
self.location('https://secure.ingdirect.fr/protected/pages/common/estatement/eStatement.jsf')
|
self.location('/protected/pages/common/estatement/eStatement.jsf')
|
||||||
self.page.selectyear(subscription._localid)
|
self.page.selectyear(subscription._localid)
|
||||||
while 1:
|
while 1:
|
||||||
for bill in self.page.iter_bills(subscription.id):
|
for bill in self.page.iter_bills(subscription.id):
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ class LoginPage2(BasePage):
|
||||||
self.browser['mrc:mrg'] = 'mrc:mrg'
|
self.browser['mrc:mrg'] = 'mrc:mrg'
|
||||||
self.browser.submit(nologin=True)
|
self.browser.submit(nologin=True)
|
||||||
|
|
||||||
|
|
||||||
class StopPage(BasePage):
|
class StopPage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
raise BrowserIncorrectPassword('Please login on website to fill the form and retry')
|
raise BrowserIncorrectPassword('Please login on website to fill the form and retry')
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ class TransferPage(BasePage):
|
||||||
onclick = select.attrib['onchange']
|
onclick = select.attrib['onchange']
|
||||||
params = onclick.split(',')[6].split('{')[1]
|
params = onclick.split(',')[6].split('{')[1]
|
||||||
idparam = params.split("'")[1]
|
idparam = params.split("'")[1]
|
||||||
param = params.split("'")[3]
|
param = params.split("'")[3]
|
||||||
request = self.browser.buildurl('', ("AJAXREQUEST", "transfer_form:transfer_radios_form"),
|
request = self.browser.buildurl('', ("AJAXREQUEST", "transfer_form:transfer_radios_form"),
|
||||||
("transfer_form:generalMessages", ""),
|
("transfer_form:generalMessages", ""),
|
||||||
("transfer_issuer_radio", account.id[3:]),
|
("transfer_issuer_radio", account.id[3:]),
|
||||||
|
|
@ -123,7 +123,7 @@ class TransferPage(BasePage):
|
||||||
break
|
break
|
||||||
params = onclick.split(',')[6].split('{')[1]
|
params = onclick.split(',')[6].split('{')[1]
|
||||||
idparam = params.split("'")[1]
|
idparam = params.split("'")[1]
|
||||||
param = params.split("'")[3]
|
param = params.split("'")[3]
|
||||||
request = self.browser.buildurl('', ("AJAXREQUEST", "transfer_form:transfer_radios_form"),
|
request = self.browser.buildurl('', ("AJAXREQUEST", "transfer_form:transfer_radios_form"),
|
||||||
("transfer_form:generalMessages", ""),
|
("transfer_form:generalMessages", ""),
|
||||||
('transfer_issuer_radio', account.id[3:]),
|
('transfer_issuer_radio', account.id[3:]),
|
||||||
|
|
@ -145,7 +145,6 @@ class TransferConfirmPage(BasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def confirm(self, password):
|
def confirm(self, password):
|
||||||
try:
|
try:
|
||||||
vk = INGVirtKeyboard(self)
|
vk = INGVirtKeyboard(self)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue