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
|
||||
from __future__ import with_statement
|
||||
|
||||
from weboob.capabilities.bank import ICapBank, AccountNotFound, Account, Recipient
|
||||
from weboob.capabilities.bill import ICapBill, Bill, Subscription, SubscriptionNotFound, BillNotFound
|
||||
from weboob.capabilities.bank import ICapBank, AccountNotFound,\
|
||||
Account, Recipient
|
||||
from weboob.capabilities.bill import ICapBill, Bill, Subscription,\
|
||||
SubscriptionNotFound, BillNotFound
|
||||
from weboob.tools.backend import BaseBackend, BackendConfig
|
||||
from weboob.tools.value import ValueBackendPassword
|
||||
|
||||
|
|
@ -56,7 +58,6 @@ class INGBackend(BaseBackend, ICapBank, ICapBill):
|
|||
self.config['password'].get(),
|
||||
birthday=self.config['birthday'].get())
|
||||
|
||||
|
||||
def iter_resources(self, objs, split_path):
|
||||
if Account in objs:
|
||||
self._restrict_level(split_path)
|
||||
|
|
|
|||
|
|
@ -48,12 +48,18 @@ class Ing(BaseBrowser):
|
|||
}
|
||||
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):
|
||||
self.birthday = kwargs.pop('birthday', None)
|
||||
BaseBrowser.__init__(self, *args, **kwargs)
|
||||
|
||||
def home(self):
|
||||
self.location('https://secure.ingdirect.fr/public/displayLogin.jsf')
|
||||
self.location(self.loginpage)
|
||||
|
||||
def is_logged(self):
|
||||
return not self.is_on_page(LoginPage)
|
||||
|
|
@ -66,8 +72,7 @@ class Ing(BaseBrowser):
|
|||
assert self.birthday.isdigit()
|
||||
|
||||
if not self.is_on_page(LoginPage):
|
||||
self.location('https://secure.ingdirect.fr/\
|
||||
public/displayLogin.jsf')
|
||||
self.location(self.loginpage)
|
||||
|
||||
self.page.prelogin(self.username, self.birthday)
|
||||
self.page.login(self.password)
|
||||
|
|
@ -76,7 +81,7 @@ class Ing(BaseBrowser):
|
|||
|
||||
def get_accounts_list(self):
|
||||
if not self.is_on_page(AccountsList):
|
||||
self.location('/general?command=displayTRAccountSummary')
|
||||
self.location(self.accountspage)
|
||||
|
||||
return self.page.get_list()
|
||||
|
||||
|
|
@ -84,7 +89,7 @@ class Ing(BaseBrowser):
|
|||
assert isinstance(id, basestring)
|
||||
|
||||
if not self.is_on_page(AccountsList):
|
||||
self.location('/general?command=displayTRAccountSummary')
|
||||
self.location(self.accountspage)
|
||||
|
||||
l = self.page.get_list()
|
||||
for a in l:
|
||||
|
|
@ -103,11 +108,13 @@ class Ing(BaseBrowser):
|
|||
account = self.get_account(account)
|
||||
# The first and the second letter of the label are the account type
|
||||
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":
|
||||
# we want "displayTRHistoriqueLA" but this fucking page
|
||||
# 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:
|
||||
raise NotImplementedError()
|
||||
while 1:
|
||||
|
|
@ -120,19 +127,20 @@ class Ing(BaseBrowser):
|
|||
if self.page.islast():
|
||||
return
|
||||
|
||||
# XXX server sends an unknown mimetype, we overload viewing_html() above to
|
||||
# prevent this issue.
|
||||
# XXX server sends an unknown mimetype, we overload
|
||||
# viewing_html() above to prevent this issue.
|
||||
self.page.next_page()
|
||||
|
||||
def get_recipients(self, account):
|
||||
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):
|
||||
return self.page.get_recipients()
|
||||
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.location('https://secure.ingdirect.fr/general?command=DisplayDoTransferCommand')
|
||||
self.location(self.dotransferpage)
|
||||
return self.page.get_recipients()
|
||||
|
||||
def transfer(self, account, recipient, amount, reason):
|
||||
|
|
@ -146,25 +154,26 @@ class Ing(BaseBrowser):
|
|||
recipient = destination
|
||||
break
|
||||
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.location('/protected/pages/cc/transfer/create/transferCreateValidation.jsf')
|
||||
self.location(self.valtransferpage)
|
||||
if not self.is_on_page(TransferConfirmPage):
|
||||
raise TransferError("Invalid transfer (no confirmation page)")
|
||||
else:
|
||||
self.page.confirm(self.password)
|
||||
self.location('/protected/pages/cc/transfer/create/transferCreateValidation.jsf')
|
||||
self.location(self.valtransferpage)
|
||||
return self.page.recap()
|
||||
else:
|
||||
raise TransferError('Recipient not found')
|
||||
|
||||
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()
|
||||
|
||||
def get_bills(self, subscription):
|
||||
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)
|
||||
while 1:
|
||||
for bill in self.page.iter_bills(subscription.id):
|
||||
|
|
|
|||
|
|
@ -137,6 +137,7 @@ class LoginPage2(BasePage):
|
|||
self.browser['mrc:mrg'] = 'mrc:mrg'
|
||||
self.browser.submit(nologin=True)
|
||||
|
||||
|
||||
class StopPage(BasePage):
|
||||
def on_loaded(self):
|
||||
raise BrowserIncorrectPassword('Please login on website to fill the form and retry')
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class TransferPage(BasePage):
|
|||
onclick = select.attrib['onchange']
|
||||
params = onclick.split(',')[6].split('{')[1]
|
||||
idparam = params.split("'")[1]
|
||||
param = params.split("'")[3]
|
||||
param = params.split("'")[3]
|
||||
request = self.browser.buildurl('', ("AJAXREQUEST", "transfer_form:transfer_radios_form"),
|
||||
("transfer_form:generalMessages", ""),
|
||||
("transfer_issuer_radio", account.id[3:]),
|
||||
|
|
@ -123,7 +123,7 @@ class TransferPage(BasePage):
|
|||
break
|
||||
params = onclick.split(',')[6].split('{')[1]
|
||||
idparam = params.split("'")[1]
|
||||
param = params.split("'")[3]
|
||||
param = params.split("'")[3]
|
||||
request = self.browser.buildurl('', ("AJAXREQUEST", "transfer_form:transfer_radios_form"),
|
||||
("transfer_form:generalMessages", ""),
|
||||
('transfer_issuer_radio', account.id[3:]),
|
||||
|
|
@ -145,13 +145,12 @@ class TransferConfirmPage(BasePage):
|
|||
def on_loaded(self):
|
||||
pass
|
||||
|
||||
|
||||
def confirm(self, password):
|
||||
try:
|
||||
vk = INGVirtKeyboard(self)
|
||||
except VirtKeyboardError, err:
|
||||
error("Error: %s" % err)
|
||||
return
|
||||
return
|
||||
realpasswd = ""
|
||||
span = self.document.find('//span[@id="digitpadtransfer"]')
|
||||
i = 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue