Account.link_id becomes a private attribute
This commit is contained in:
parent
679177d450
commit
35688f58c9
18 changed files with 37 additions and 30 deletions
|
|
@ -76,11 +76,11 @@ class BNPorcBackend(BaseBackend, ICapBank):
|
|||
|
||||
def iter_history(self, account):
|
||||
with self.browser:
|
||||
return self.browser.iter_history(account.link_id)
|
||||
return self.browser.iter_history(account._link_id)
|
||||
|
||||
def iter_operations(self, account):
|
||||
with self.browser:
|
||||
return self.browser.iter_coming_operations(account.link_id)
|
||||
return self.browser.iter_coming_operations(account._link_id)
|
||||
|
||||
def iter_transfer_recipients(self, ignored):
|
||||
for account in self.browser.get_transfer_accounts().itervalues():
|
||||
|
|
|
|||
|
|
@ -76,6 +76,8 @@ class BNPorc(BaseBrowser):
|
|||
if self.is_on_page(LoginPage):
|
||||
raise BrowserIncorrectPassword()
|
||||
|
||||
#self.readurl('/SAF_SOA?Action=6')
|
||||
|
||||
def change_password(self, new_password):
|
||||
assert new_password.isdigit() and len(new_password) == 6
|
||||
|
||||
|
|
@ -85,6 +87,9 @@ class BNPorc(BaseBrowser):
|
|||
self.location(buf)
|
||||
assert self.is_on_page(ChangePasswordPage)
|
||||
|
||||
#self.readurl('/banque/portail/particulier/bandeau')
|
||||
#self.readurl('/common/vide.htm')
|
||||
|
||||
self.page.change_password(self.password, new_password)
|
||||
|
||||
if not self.is_on_page(ConfirmPage) or self.page.get_error() is not None:
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class AccountsList(BasePage):
|
|||
if tr.find('td') is not None and tr.find('td').attrib.get('class', '') == 'typeTitulaire':
|
||||
account = Account()
|
||||
account.id = tr.xpath('.//td[@class="libelleCompte"]/input')[0].attrib['id'][len('libelleCompte'):]
|
||||
account.link_id = account.id
|
||||
account._link_id = account.id
|
||||
if len(str(account.id)) == 23:
|
||||
account.id = str(account.id)[5:21]
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import time
|
||||
import re
|
||||
from weboob.tools.mech import ClientForm
|
||||
import urllib
|
||||
|
|
@ -41,13 +42,13 @@ class BNPVirtKeyboard(MappedVirtKeyboard):
|
|||
'9':'828cf0faf86ac78e7f43208907620527'
|
||||
}
|
||||
|
||||
url="/NSImgGrille"
|
||||
url="/NSImgGrille?timestamp=%d"
|
||||
|
||||
color=27
|
||||
|
||||
def __init__(self,basepage):
|
||||
img=basepage.document.find("//img[@usemap='#MapGril']")
|
||||
MappedVirtKeyboard.__init__(self,basepage.browser.openurl(self.url),basepage.document,img,self.color)
|
||||
MappedVirtKeyboard.__init__(self,basepage.browser.openurl(self.url % time.time()),basepage.document,img,self.color)
|
||||
if basepage.browser.responses_dirname is None:
|
||||
basepage.browser.responses_dirname = \
|
||||
tempfile.mkdtemp(prefix='weboob_session_')
|
||||
|
|
@ -135,7 +136,7 @@ class ChangePasswordPage(BasePage):
|
|||
code_current=vk.get_string_code(current)
|
||||
code_new=vk.get_string_code(new)
|
||||
|
||||
data = (('ch1', code_current.replace('4', '3')),
|
||||
data = (('ch1', code_current),
|
||||
('ch2', code_new),
|
||||
('radiobutton3', 'radiobutton'),
|
||||
('ch3', code_new),
|
||||
|
|
|
|||
|
|
@ -81,15 +81,15 @@ class Boursorama(BaseBrowser):
|
|||
return None
|
||||
|
||||
def get_history(self, account):
|
||||
self.location(account.link_id)
|
||||
self.location(account._link_id)
|
||||
operations = self.page.get_operations()
|
||||
# load last month as well
|
||||
target = date.today() - relativedelta( months = 1 )
|
||||
self.location(account.link_id + ("&month=%d&year=%d" % (target.month, target.year)))
|
||||
self.location(account._link_id + ("&month=%d&year=%d" % (target.month, target.year)))
|
||||
operations += self.page.get_operations()
|
||||
# and the month before, just in case you're greedy
|
||||
target = date.today() - relativedelta( months = 2 )
|
||||
self.location(account.link_id + ("&month=%d&year=%d" % (target.month, target.year)))
|
||||
self.location(account._link_id + ("&month=%d&year=%d" % (target.month, target.year)))
|
||||
operations += self.page.get_operations()
|
||||
for index, op in enumerate(operations):
|
||||
op.id = index
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ class AccountsList(BasePage):
|
|||
elif td.attrib.get('class', '') == 'account-name':
|
||||
a = td.find('a')
|
||||
account.label = a.text
|
||||
account.link_id = a.get('href', '')
|
||||
account._link_id = a.get('href', '')
|
||||
|
||||
elif td.attrib.get('class', '') == 'account-number':
|
||||
id = td.text
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class BPBrowser(BaseBrowser):
|
|||
return self.page.get_account(id)
|
||||
|
||||
def get_history(self, Account):
|
||||
self.location(Account.link_id)
|
||||
self.location(Account._link_id)
|
||||
return self.page.get_history()
|
||||
|
||||
def make_transfer(self, from_account, to_account, amount):
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class AccountList(BasePage):
|
|||
account = Account()
|
||||
tmp = line.xpath("./td//a")[0]
|
||||
account.label = tmp.text
|
||||
account.link_id = tmp.get("href")
|
||||
account._link_id = tmp.get("href")
|
||||
|
||||
tmp = line.xpath("./td/span/strong")
|
||||
if len(tmp) >= 2:
|
||||
|
|
|
|||
|
|
@ -132,9 +132,9 @@ class Cragr(BaseBrowser):
|
|||
|
||||
def get_history(self, account):
|
||||
# some accounts may exist without a link to any history page
|
||||
if account.link_id is None:
|
||||
if account._link_id is None:
|
||||
return
|
||||
history_url = account.link_id
|
||||
history_url = account._link_id
|
||||
operations_count = 0
|
||||
|
||||
# 1st, go on the account page
|
||||
|
|
@ -258,5 +258,5 @@ class Cragr(BaseBrowser):
|
|||
|
||||
#def get_coming_operations(self, account):
|
||||
# if not self.is_on_page(AccountComing) or self.page.account.id != account.id:
|
||||
# self.location('/NS_AVEEC?ch4=%s' % account.link_id)
|
||||
# self.location('/NS_AVEEC?ch4=%s' % account._link_id)
|
||||
# return self.page.get_operations()
|
||||
|
|
|
|||
|
|
@ -45,11 +45,12 @@ class AccountsList(CragrBasePage):
|
|||
for div in self.document.getiterator('div'):
|
||||
if div.attrib.get('class', '') == 'dv' and div.getchildren()[0].tag in ('a', 'br'):
|
||||
account = Account()
|
||||
account._link_id = None
|
||||
if div.getchildren()[0].tag == 'a':
|
||||
# This is at least present on CA Nord-Est
|
||||
# Note: we do not know yet how history-less accounts are displayed by this layout
|
||||
account.label = ' '.join(div.find('a').text.split()[:-1])
|
||||
account.link_id = div.find('a').get('href', '')
|
||||
account._link_id = div.find('a').get('href', '')
|
||||
account.id = div.find('a').text.split()[-1]
|
||||
s = div.find('div').find('b').find('span').text
|
||||
else:
|
||||
|
|
@ -57,12 +58,12 @@ class AccountsList(CragrBasePage):
|
|||
first_link = div.find('a')
|
||||
if first_link is not None:
|
||||
account.label = first_link.text.strip()
|
||||
account.link_id = first_link.get('href', '')
|
||||
account._link_id = first_link.get('href', '')
|
||||
s = div.find('div').find('b').text
|
||||
else:
|
||||
# there is no link to any history page for accounts like "PEA" or "TITRES"
|
||||
account.label = div.findall('br')[0].tail.strip()
|
||||
account.link_id = None
|
||||
account._link_id = None
|
||||
s = div.xpath('following-sibling::div//b')[0].text
|
||||
account.id = div.findall('br')[1].tail.strip()
|
||||
account.balance = clean_amount(s)
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ class CreditMutuelBrowser(BaseBrowser):
|
|||
self.currentSubBank = subbank
|
||||
|
||||
def get_history(self, account):
|
||||
page_url = account.link_id
|
||||
page_url = account._link_id
|
||||
#operations_count = 0
|
||||
l_ret = []
|
||||
while (page_url):
|
||||
|
|
@ -170,5 +170,5 @@ class CreditMutuelBrowser(BaseBrowser):
|
|||
|
||||
#def get_coming_operations(self, account):
|
||||
# if not self.is_on_page(AccountComing) or self.page.account.id != account.id:
|
||||
# self.location('/NS_AVEEC?ch4=%s' % account.link_id)
|
||||
# self.location('/NS_AVEEC?ch4=%s' % account._link_id)
|
||||
# return self.page.get_operations()
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@ class AccountsPage(BasePage):
|
|||
if first_td.attrib.get('class', '') == 'i g' or first_td.attrib.get('class', '') == 'p g':
|
||||
account = Account()
|
||||
account.label = u"%s"%first_td.find('a').text.strip()
|
||||
account.link_id = first_td.find('a').get('href', '')
|
||||
if account.link_id.startswith('POR_SyntheseLst'):
|
||||
account._link_id = first_td.find('a').get('href', '')
|
||||
if account._link_id.startswith('POR_SyntheseLst'):
|
||||
continue
|
||||
|
||||
account.id = first_td.find('a').text.split(' ')[0]+first_td.find('a').text.split(' ')[1]
|
||||
|
|
|
|||
|
|
@ -57,5 +57,5 @@ class HSBCBackend(BaseBackend, ICapBank):
|
|||
|
||||
def iter_history(self, account):
|
||||
with self.browser:
|
||||
for history in self.browser.get_history(account.link_id):
|
||||
for history in self.browser.get_history(account._link_id):
|
||||
yield history
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ class AccountsListPage(BasePage):
|
|||
|
||||
a = tds[0].findall('a')[-1]
|
||||
account.label = a.text.strip()
|
||||
account.link_id = a.attrib['href']
|
||||
account._link_id = a.attrib['href']
|
||||
|
||||
if not 'CPT_IdPrestation' in account.link_id:
|
||||
if not 'CPT_IdPrestation' in account._link_id:
|
||||
continue
|
||||
|
||||
tag = tds[2].find('font')
|
||||
|
|
|
|||
|
|
@ -84,10 +84,10 @@ class LCLBrowser(BaseBrowser):
|
|||
|
||||
def get_history(self,account):
|
||||
if not self.is_on_page(AccountHistoryPage) :
|
||||
self.location('%s://%s%s' % (self.PROTOCOL, self.DOMAIN, account.link_id))
|
||||
self.location('%s://%s%s' % (self.PROTOCOL, self.DOMAIN, account._link_id))
|
||||
return self.page.get_operations(account)
|
||||
|
||||
#def get_coming_operations(self, account):
|
||||
# if not self.is_on_page(AccountComing) or self.page.account.id != account.id:
|
||||
# self.location('/NS_AVEEC?ch4=%s' % account.link_id)
|
||||
# self.location('/NS_AVEEC?ch4=%s' % account._link_id)
|
||||
# return self.page.get_operations()
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ class AccountsPage(BasePage):
|
|||
link=a.attrib.get('href')
|
||||
if link is not None and link.startswith("/outil/UWLM/ListeMouvements"):
|
||||
account = Account()
|
||||
account.link_id=link+"&mode=45"
|
||||
account._link_id=link+"&mode=45"
|
||||
parameters=link.split("?").pop().split("&")
|
||||
for parameter in parameters:
|
||||
list=parameter.split("=")
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class SocieteGenerale(BaseBrowser):
|
|||
raise NotImplementedError()
|
||||
|
||||
#if not self.is_on_page(AccountHistory) or self.page.account.id != account.id:
|
||||
# self.location(account.link_id)
|
||||
# self.location(account._link_id)
|
||||
#return self.page.get_operations()
|
||||
|
||||
def transfer(self, from_id, to_id, amount, reason=None):
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ class AccountsList(BasePage):
|
|||
if td.attrib.get('headers', '') == 'TypeCompte':
|
||||
a = td.find('a')
|
||||
account.label = a.find("span").text
|
||||
account.link_id = a.get('href', '')
|
||||
account._link_id = a.get('href', '')
|
||||
|
||||
elif td.attrib.get('headers', '') == 'NumeroCompte':
|
||||
id = td.text
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue