pax_global_header 0000666 0000000 0000000 00000000064 14575653726 0014536 g ustar 00root root 0000000 0000000 52 comment=5f3d558793b537a74480241ac6981479f5938cd3
woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-ticketscesu/ 0000775 0000000 0000000 00000000000 14575653726 0024370 5 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-ticketscesu/modules/ 0000775 0000000 0000000 00000000000 14575653726 0026040 5 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-ticketscesu/modules/ticketscesu/ 0000775 0000000 0000000 00000000000 14575653726 0030366 5 ustar 00root root 0000000 0000000 __init__.py 0000664 0000000 0000000 00000001515 14575653726 0032422 0 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-ticketscesu/modules/ticketscesu # -*- coding: utf-8 -*-
# Copyright(C) 2019 Antoine BOSSY
#
# This file is part of a woob module.
#
# This woob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This woob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this woob module. If not, see .
from .module import TicketsCesuModule
__all__ = ['TicketsCesuModule']
browser.py 0000664 0000000 0000000 00000004257 14575653726 0032354 0 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-ticketscesu/modules/ticketscesu # -*- coding: utf-8 -*-
# Copyright(C) 2019 Antoine BOSSY
#
# This file is part of a woob module.
#
# This woob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This woob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this woob module. If not, see .
from woob.browser import LoginBrowser, URL, need_login
from woob.exceptions import ActionNeeded, ActionType, BrowserIncorrectPassword
from .pages import AccountsPage, LoginPage, ProfilePage
class TicketCesuBrowser(LoginBrowser):
BASEURL = 'https://ebeneficiaire.cesu-as.fr'
login_page = URL('/login.aspx', LoginPage)
profile_page = URL('/customerManagement/ProfileManagement.aspx', ProfilePage)
accounts_page = URL('/PaymentManagement/PaymentAccountInfoFullDemat.aspx', AccountsPage)
def do_login(self):
self.login_page.go()
self.page.login(self.username, self.password)
if self.login_page.is_here():
# Wrong credentials leads back here, with JS generated message, hard-coded in the exception raised.
raise BrowserIncorrectPassword('login et / ou mot de passe erroné')
elif self.profile_page.is_here():
raise ActionNeeded(
locale="en-US", message="Please agree CGU on the CESU website.",
action_type=ActionType.ACKNOWLEDGE,
)
@need_login
def iter_accounts(self):
self.accounts_page.go()
return self.page.iter_accounts()
@need_login
def iter_history(self, account):
self.accounts_page.stay_or_go()
self.page.go_to_transactions_page(account._page)
return self.page.iter_transactions()
@need_login
def iter_subscription(self):
return []
module.py 0000664 0000000 0000000 00000004201 14575653726 0032143 0 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-ticketscesu/modules/ticketscesu # -*- coding: utf-8 -*-
# Copyright(C) 2019 Antoine BOSSY
#
# This file is part of a woob module.
#
# This woob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This woob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this woob module. If not, see .
from woob.capabilities.bill import CapDocument
from woob.tools.backend import Module, BackendConfig
from woob.tools.value import ValueBackendPassword, Value
from .browser import TicketCesuBrowser
__all__ = ['TicketsCesuModule']
class TicketsCesuModule(Module, CapDocument):
"""Almost empty module at the moment: not tested in the wild.
CapBank methods were written from a previous version of the module, but not tested and not in any present use case.
–> CapBank not implemented.
CapDocument methods are not written but are to be done once connections are made
–> CapDocument methods to be implemented
"""
NAME = 'ticketscesu'
DESCRIPTION = 'Tickets CESU Edenred'
MAINTAINER = 'Antoine BOSSY'
EMAIL = 'mail+github@abossy.fr'
LICENSE = 'LGPLv3+'
VERSION = '3.6'
BROWSER = TicketCesuBrowser
CONFIG = BackendConfig(
Value('login', label='Identifiant', masked=False),
ValueBackendPassword('password', label='Code secret', required=True)
)
def create_default_browser(self):
return self.create_browser(self.config['login'].get(), self.config['password'].get())
def iter_accounts(self):
return self.browser.iter_accounts()
def iter_history(self, account):
return self.browser.iter_history(account.id)
def iter_subscription(self):
return self.browser.iter_subscription()
pages.py 0000664 0000000 0000000 00000006433 14575653726 0031766 0 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-ticketscesu/modules/ticketscesu # -*- coding: utf-8 -*-
# Copyright(C) 2019 Antoine BOSSY
#
# This file is part of a woob module.
#
# This woob module is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This woob module is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this woob module. If not, see .
from woob.browser.elements import method, ItemElement, ListElement, SkipItem
from woob.browser.filters.standard import CleanDecimal, CleanText, Field, Format, Date
from woob.browser.filters.html import Attr
from woob.browser.pages import HTMLPage, LoggedPage
from woob.capabilities.bank import Account, Transaction
from woob.capabilities.base import NotAvailable
class LoginPage(HTMLPage):
def login(self, login, password):
form = self.get_form('//form[@id="frmMain"]')
form['UserLogin'] = login
form['UserPass'] = password
form.submit()
class ProfilePage(HTMLPage):
pass
class AccountsPage(LoggedPage, HTMLPage):
@method
class iter_accounts(ListElement):
item_xpath = '//tr[has-class("ItemH23")]'
class item(ItemElement):
klass = Account
# TODO: control all these attributes
# obj_type = '??????'
obj_id = CleanText('./td[position()=2]')
obj_balance = CleanDecimal('./td[position()=6]', replace_dots=True)
obj_label = Format('Millésime %s', Field('id'))
obj_number = Field('id')
obj_currency = 'EUR'
obj__page = Attr('./td//input', 'name')
def go_to_transactions_page(self, page):
form = self.get_form('//form[@id="frmMain"]')
form[f'{page}.x'] = 1
form[f'{page}.y'] = 1
form.submit()
@method
class iter_transactions(ListElement):
item_xpath = '//tr[has-class("ItemH23")]'
class item(ItemElement):
klass = Transaction
# TODO: control all these attributes
def obj_date(self):
maybe_date = CleanText('./td[position()=2]')(self)
if maybe_date == '-':
raise SkipItem()
return Date(CleanText('./td[position()=2]'), dayfirst=True)(self)
obj_id = CleanText('./td[position()=3]')
def obj_amount(self):
amount = CleanDecimal('./td[position()=4]', replace_dots=True,
default=NotAvailable)(self)
if amount is NotAvailable:
return CleanDecimal('./td[position()=5]', replace_dots=True)(self)
return amount * -1
obj_currency = 'EUR'
def obj_label(self):
label = CleanText('./td[position()=6]')(self)
if label == '-':
return CleanText('./td[position()=7]')(self)
return label
obj_raw = Field('label')
requirements.txt 0000664 0000000 0000000 00000000014 14575653726 0033566 0 ustar 00root root 0000000 0000000 woob-master-5f3d558793b537a74480241ac6981479f5938cd3-modules-ticketscesu/modules/ticketscesu woob ~= 3.2