From 8bbcfcd268fbe3d0cad90a1a655a071fcae729ad Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Sat, 5 Jan 2019 15:27:27 +0100 Subject: [PATCH] alloresto: remove broken module --- modules/alloresto/__init__.py | 23 ----------- modules/alloresto/browser.py | 66 ------------------------------ modules/alloresto/favicon.png | Bin 2320 -> 0 bytes modules/alloresto/module.py | 61 --------------------------- modules/alloresto/pages.py | 75 ---------------------------------- modules/alloresto/test.py | 32 --------------- 6 files changed, 257 deletions(-) delete mode 100644 modules/alloresto/__init__.py delete mode 100644 modules/alloresto/browser.py delete mode 100644 modules/alloresto/favicon.png delete mode 100644 modules/alloresto/module.py delete mode 100644 modules/alloresto/pages.py delete mode 100644 modules/alloresto/test.py diff --git a/modules/alloresto/__init__.py b/modules/alloresto/__init__.py deleted file mode 100644 index 712ff08d24..0000000000 --- a/modules/alloresto/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2014 Romain Bignon -# -# This file is part of weboob. -# -# weboob is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# weboob 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with weboob. If not, see . - - -from .module import AlloRestoModule - -__all__ = ['AlloRestoModule'] diff --git a/modules/alloresto/browser.py b/modules/alloresto/browser.py deleted file mode 100644 index d790c92a96..0000000000 --- a/modules/alloresto/browser.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2014 Romain Bignon -# -# This file is part of weboob. -# -# weboob is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# weboob 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with weboob. If not, see . - - -from weboob.browser import LoginBrowser, URL, need_login -from weboob.exceptions import BrowserIncorrectPassword - -from .pages import LoginPage, AccountsPage - - -__all__ = ['AlloRestoBrowser'] - - -class AlloRestoBrowser(LoginBrowser): - BASEURL = 'https://www.alloresto.fr' - - login = URL('/identification-requise.*', LoginPage) - accounts = URL('/chez-moi/releve-compte-miams', AccountsPage) - - def do_login(self): - assert isinstance(self.username, basestring) - assert isinstance(self.password, basestring) - - self.accounts.stay_or_go() - self.page.login(self.username, self.password) - - if self.login.is_here(): - raise BrowserIncorrectPassword() - - @need_login - def get_accounts_list(self): - return self.accounts.stay_or_go().iter_accounts() - - @need_login - def get_account(self, id): - assert isinstance(id, basestring) - - for a in self.get_accounts_list(): - if a.id == id: - return a - - return None - - @need_login - def get_history(self, account): - return self.accounts.stay_or_go().get_transactions(type='consommable') - - @need_login - def get_coming(self, account): - return self.accounts.stay_or_go().get_transactions(type='acquisition') diff --git a/modules/alloresto/favicon.png b/modules/alloresto/favicon.png deleted file mode 100644 index b1b365c6dac425feb9450fa5c73a1957bb68d000..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2320 zcmV+r3GeoaP)ZSky02y>e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00?+VL_t(|+U;3uaFo>nyN98fD) zX)06{sI)>L0!fSlNz9ETyO~@!*~_=zcb=y|zHisfZZ?UM?XT~d*&n;_d(Qiw=e*}V z?|T;T;lqayA3l8e@ZrOU4<9~!`0(*5qQC{_;fFgJ4tMqT_MVe1H{IQJtgQ_@!1srn zXS8~mh`sVkDR=HX%I0R9mL>M|kX2PZ&d!}LG&VM#{(m9BEL*mZ#z>Nqt*t-KmdgWy z=y3ClRxbs+tn3~}B1U<@`udY?ZEa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f082pn*2oNh z?{-<3Cg7fXYCL=Y$c+GRXBY~JbLXZOvm*g~YBV`a#t<^B_-k$Pq>9geZ9uz=?PORpI7rOb! z7?PypIM(_FfRdpePS$@mw;3!DL})v)TCpK`DJbh9X#l;yj%pVtmH9|t5$XK$Pp3<5%?nj z*z@N7ncKI!xgvEOl1Z_%Gn1^f-W>A@7|xj^ZrC8Uw79i-d%L)GE6oEBY#8AP_42?0 z@%7h-J#LwuWKK&R4%0L>{l~WLD~25G0M`&$H*Ck073Kzbl)zyEeFTiRXp2B6f$}79 zX~z8X3H+Bpj6g4eN&-(?z{MlJR=G{oY6n;}l5PZ;L|`R>V+0Ze+6b(-fN%K!_WJPQ q!-o$aK79D_;lqayA3l8e0R9IFRg;Xs2z5aK0000. - - -from weboob.capabilities.bank import CapBank, AccountNotFound -from weboob.tools.backend import Module, BackendConfig -from weboob.tools.value import ValueBackendPassword - -from .browser import AlloRestoBrowser - - -__all__ = ['AlloRestoModule'] - - -class AlloRestoModule(Module, CapBank): - NAME = 'alloresto' - MAINTAINER = u'Romain Bignon' - EMAIL = 'romain@weboob.org' - VERSION = '1.4' - DESCRIPTION = u'Allo Resto' - LICENSE = 'AGPLv3+' - CONFIG = BackendConfig(ValueBackendPassword('login', label='Identifiant', masked=False), - ValueBackendPassword('password', label='Mot de passe')) - BROWSER = AlloRestoBrowser - - def create_default_browser(self): - return self.create_browser(self.config['login'].get(), - self.config['password'].get()) - - def iter_accounts(self): - return self.browser.get_accounts_list() - - def get_account(self, _id): - account = self.browser.get_account(_id) - - if account: - return account - else: - raise AccountNotFound() - - def iter_history(self, account): - return self.browser.get_history(account) - - def iter_coming(self, account): - return self.browser.get_coming(account) diff --git a/modules/alloresto/pages.py b/modules/alloresto/pages.py deleted file mode 100644 index 1e248da5b8..0000000000 --- a/modules/alloresto/pages.py +++ /dev/null @@ -1,75 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2014 Romain Bignon -# -# This file is part of weboob. -# -# weboob is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# weboob 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with weboob. If not, see . - - -import datetime -from decimal import Decimal - -from weboob.browser.pages import HTMLPage, LoggedPage -from weboob.browser.elements import ItemElement, method -from weboob.browser.filters.standard import CleanDecimal, CleanText, Filter, TableCell -from weboob.capabilities.bank import Account -from weboob.tools.capabilities.bank.transactions import FrenchTransaction as Transaction - - -class LoginPage(HTMLPage): - def login(self, username, password): - form = self.get_form(xpath='//form[has-class("form_o")]') - form['uname'] = username - form['pass'] = password - form.submit() - - -class AccountsPage(LoggedPage, HTMLPage): - @method - class iter_accounts(ItemElement): - def __call__(self): - return self - - klass = Account - - obj_id = '0' - obj_label = u'Compte miams' - obj_balance = CleanDecimal('//div[@class="compteur"]//strong', replace_dots=True) - obj_currency = u'MIAM' - obj_coming = CleanDecimal('//table[@id="solde_acquisition_lignes"]//th[@class="col_montant"]', default=Decimal('0'), replace_dots=True) - - class MyDate(Filter): - MONTHS = ['janv', u'févr', u'mars', u'avr', u'mai', u'juin', u'juil', u'août', u'sept', u'oct', u'nov', u'déc'] - - def filter(self, txt): - day, month, year = txt.split(' ') - day = int(day) - year = int(year) - month = self.MONTHS.index(month.rstrip('.')) + 1 - return datetime.date(year, month, day) - - def get_transactions(self, type='consommable'): - class get_history(Transaction.TransactionsElement): - head_xpath = '//table[@id="solde_%s_lignes"]//thead//tr/th/text()' % type - item_xpath = '//table[@id="solde_%s_lignes"]//tbody/tr' % type - - col_date = u"Date de valeur" - col_raw = u"Motif" - - class item(Transaction.TransactionElement): - obj_amount = Transaction.Amount('./td[last()]') - obj_date = AccountsPage.MyDate(CleanText(TableCell('date'))) - - return get_history(self)() diff --git a/modules/alloresto/test.py b/modules/alloresto/test.py deleted file mode 100644 index a31ea0d08b..0000000000 --- a/modules/alloresto/test.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- - -# Copyright(C) 2014 Romain Bignon -# -# This file is part of weboob. -# -# weboob is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# weboob 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 Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with weboob. If not, see . - - -from weboob.tools.test import BackendTest - - -class AlloRestoTest(BackendTest): - MODULE = 'alloresto' - - def test_alloresto(self): - l = list(self.backend.iter_accounts()) - - a = l[0] - list(self.backend.iter_history(a)) - list(self.backend.iter_coming(a)) -- GitLab