Pep8 cleaning, fix author of test.py
This commit is contained in:
parent
e3962eac7b
commit
bda8df7e9b
5 changed files with 18 additions and 12 deletions
|
|
@ -18,13 +18,14 @@
|
|||
# along with weboob. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from weboob.capabilities.bill import ICapBill, SubscriptionNotFound,\
|
||||
BillNotFound, Subscription, Bill
|
||||
BillNotFound, Subscription, Bill
|
||||
from weboob.tools.backend import BaseBackend, BackendConfig
|
||||
from weboob.tools.value import ValueBackendPassword
|
||||
from .browser import GdfSuez
|
||||
|
||||
__all__ = ['GdfSuezBackend']
|
||||
|
||||
|
||||
class GdfSuezBackend(BaseBackend, ICapBill):
|
||||
NAME = 'gdfsuez'
|
||||
MAINTAINER = u'Mathieu Jourdan'
|
||||
|
|
@ -38,7 +39,7 @@ class GdfSuezBackend(BaseBackend, ICapBill):
|
|||
ValueBackendPassword('password',
|
||||
label='Password',
|
||||
masked=True)
|
||||
)
|
||||
)
|
||||
BROWSER = GdfSuez
|
||||
|
||||
def create_default_browser(self):
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ from .pages import LoginPage, HomePage, AccountPage, TimeoutPage, HistoryPage, P
|
|||
|
||||
__all__ = ['GdfSuez']
|
||||
|
||||
|
||||
class GdfSuez(BaseBrowser):
|
||||
PROTOCOL = 'https'
|
||||
DOMAIN = 'www.gdfsuez-dolcevita.fr'
|
||||
|
|
@ -31,7 +32,7 @@ class GdfSuez(BaseBrowser):
|
|||
'.*p/visualiser_mes_contrats.*?_nfpb=true': AccountPage,
|
||||
'.*p/page_historique_de_mes_factures': HistoryPage,
|
||||
'.*clients.*?_nfpb=true&_nfls=false&_pageLabel=page_erreur_timeout_session': TimeoutPage
|
||||
}
|
||||
}
|
||||
|
||||
loginp = '/portailClients/appmanager/portail/clients'
|
||||
homep = '/portailClients/appmanager/portail/clients?_nfpb=true&_pageLabel=page_accueil_compte_en_ligne'
|
||||
|
|
@ -96,4 +97,3 @@ class GdfSuez(BaseBrowser):
|
|||
for b in self.iter_bills():
|
||||
if b.id == id:
|
||||
return b
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ from weboob.capabilities.bill import Detail, Bill
|
|||
|
||||
__all__ = ['HistoryPage', 'PdfPage']
|
||||
|
||||
|
||||
class HistoryPage(BasePage):
|
||||
|
||||
def on_loaded(self):
|
||||
|
|
@ -74,6 +75,7 @@ class HistoryPage(BasePage):
|
|||
def get_bills(self):
|
||||
return self.bills
|
||||
|
||||
|
||||
class PdfPage():
|
||||
|
||||
def __init__(self, file):
|
||||
|
|
@ -106,13 +108,13 @@ class PdfPage():
|
|||
|
||||
# Parsing
|
||||
details = []
|
||||
for title in [ 'Abonnement',
|
||||
'Consommation',
|
||||
'Contributions et taxes liées à l\'énergie']:
|
||||
section = page.split(title,1)[1].split('Total ')[0]
|
||||
for title in ['Abonnement',
|
||||
'Consommation',
|
||||
'Contributions et taxes liées à l\'énergie']:
|
||||
section = page.split(title, 1)[1].split('Total ')[0]
|
||||
|
||||
# When a line holds '(0)', a newline is missing.
|
||||
section = re.sub(footnote,'\n', section)
|
||||
section = re.sub(footnote, '\n', section)
|
||||
|
||||
lines = section.split('\n')
|
||||
lines = [x for x in lines if len(x) > 0] # Remove empty lines
|
||||
|
|
@ -184,7 +186,7 @@ class PdfPage():
|
|||
vat = line.split()[line.count(' ')-1].replace(',', '.')
|
||||
detail.infos = unicode('TVA: ' + vat)
|
||||
elif ' €' in line:
|
||||
price = line.replace(',','.')
|
||||
price = line.replace(',', '.')
|
||||
if isinstance(detail, Detail):
|
||||
detail.price = Decimal(price.strip(' €'))
|
||||
elif re.match(enddate, line):
|
||||
|
|
@ -208,4 +210,3 @@ class PdfPage():
|
|||
else:
|
||||
pass
|
||||
return self._parse_page(page)
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ from weboob.capabilities.bill import Subscription
|
|||
|
||||
__all__ = ['LoginPage', 'HomePage', 'AccountPage', 'TimeoutPage']
|
||||
|
||||
|
||||
class LoginPage(BasePage):
|
||||
|
||||
def login(self, login, password):
|
||||
|
|
@ -32,11 +33,13 @@ class LoginPage(BasePage):
|
|||
self.browser["portlet_login_plein_page_3{pageFlow.mForm.password}"] = str(password)
|
||||
self.browser.submit()
|
||||
|
||||
|
||||
class HomePage(BasePage):
|
||||
|
||||
def on_loaded(self):
|
||||
pass
|
||||
|
||||
|
||||
class AccountPage(BasePage):
|
||||
|
||||
def get_subscription_list(self):
|
||||
|
|
@ -61,6 +64,7 @@ class AccountPage(BasePage):
|
|||
sub.renewdate = sdate
|
||||
yield sub
|
||||
|
||||
|
||||
class TimeoutPage(BasePage):
|
||||
|
||||
def on_loaded(self):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright(C) 2012 Romain Bignon
|
||||
# Copyright(C) 2013 Mathieu Jourdan
|
||||
#
|
||||
# This file is part of weboob.
|
||||
#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue