support multi cards list
This commit is contained in:
parent
8b95206d51
commit
3a68deb9e5
2 changed files with 20 additions and 3 deletions
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
from weboob.tools.browser import BaseBrowser, BrowserIncorrectPassword, BrowserUnavailable
|
||||
|
||||
from .pages.accounts_list import AccountsList, AccountHistory
|
||||
from .pages.accounts_list import AccountsList, AccountHistory, CardsList
|
||||
from .pages.login import LoginPage, BadLoginPage
|
||||
|
||||
|
||||
|
|
@ -39,6 +39,7 @@ class SocieteGenerale(BaseBrowser):
|
|||
'https://.*.societegenerale.fr//acces/authlgn.html': BadLoginPage,
|
||||
'https://.*.societegenerale.fr/error403.html': BadLoginPage,
|
||||
'.*restitution/cns_listeprestation.html': AccountsList,
|
||||
'.*restitution/cns_listeCartes.*.html.*': CardsList,
|
||||
'.*restitution/cns_detail.*\.html.*': AccountHistory,
|
||||
}
|
||||
|
||||
|
|
@ -112,7 +113,14 @@ class SocieteGenerale(BaseBrowser):
|
|||
for card_link in account._card_links:
|
||||
self.location(card_link)
|
||||
|
||||
transactions += list(self.page.iter_transactions(coming=True))
|
||||
if self.is_on_page(CardsList):
|
||||
for card_link in self.page.iter_cards():
|
||||
self.location(card_link)
|
||||
transactions += list(self.page.iter_transactions(coming=True))
|
||||
elif self.is_on_page(AccountHistory):
|
||||
transactions += list(self.page.iter_transactions(coming=True))
|
||||
else:
|
||||
self.logger.warning('This card is not supported')
|
||||
|
||||
def key(tr):
|
||||
# Can't compare datetime and date, so cast them.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ from weboob.tools.browser import BrokenPageError
|
|||
from .base import BasePage
|
||||
|
||||
|
||||
__all__ = ['AccountsList', 'AccountHistory']
|
||||
__all__ = ['AccountsList', 'CardsList', 'AccountHistory']
|
||||
|
||||
|
||||
class AccountsList(BasePage):
|
||||
|
|
@ -80,6 +80,15 @@ class AccountsList(BasePage):
|
|||
accounts.append(account)
|
||||
return iter(accounts)
|
||||
|
||||
class CardsList(BasePage):
|
||||
def iter_cards(self):
|
||||
for tr in self.document.getiterator('tr'):
|
||||
tds = tr.findall('td')
|
||||
if len(tds) < 4 or tds[0].attrib.get('class', '') != 'tableauIFrameEcriture1':
|
||||
continue
|
||||
|
||||
yield tr.xpath('.//a')[0].attrib['href']
|
||||
|
||||
class Transaction(FrenchTransaction):
|
||||
PATTERNS = [(re.compile(r'^CARTE \w+ RETRAIT DAB.* (?P<dd>\d{2})/(?P<mm>\d{2})( (?P<HH>\d+)H(?P<MM>\d+))? (?P<text>.*)'),
|
||||
FrenchTransaction.TYPE_WITHDRAWAL),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue