Fix obvious pep8 errors
This commit is contained in:
parent
2a7f373168
commit
a155337b4f
3 changed files with 18 additions and 16 deletions
|
|
@ -24,6 +24,7 @@ from .pages import LoginPage, HomePage, AccountPage, LastPaymentsPage, PaymentDe
|
||||||
|
|
||||||
__all__ = ['AmeliBrowser']
|
__all__ = ['AmeliBrowser']
|
||||||
|
|
||||||
|
|
||||||
class AmeliBrowser(BaseBrowser):
|
class AmeliBrowser(BaseBrowser):
|
||||||
PROTOCOL = 'https'
|
PROTOCOL = 'https'
|
||||||
DOMAIN = 'assure.ameli.fr'
|
DOMAIN = 'assure.ameli.fr'
|
||||||
|
|
|
||||||
|
|
@ -31,10 +31,12 @@ __all__ = ['AmeliBasePage', 'LoginPage', 'HomePage', 'AccountPage', 'LastPayment
|
||||||
# Ugly array to avoid the use of french locale
|
# Ugly array to avoid the use of french locale
|
||||||
FRENCH_MONTHS = [u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre']
|
FRENCH_MONTHS = [u'janvier', u'février', u'mars', u'avril', u'mai', u'juin', u'juillet', u'août', u'septembre', u'octobre', u'novembre', u'décembre']
|
||||||
|
|
||||||
|
|
||||||
class AmeliBasePage(BasePage):
|
class AmeliBasePage(BasePage):
|
||||||
def is_logged(self):
|
def is_logged(self):
|
||||||
return len(self.document.xpath('//a[@id="logout"]')) > 0
|
return len(self.document.xpath('//a[@id="logout"]')) > 0
|
||||||
|
|
||||||
|
|
||||||
class LoginPage(AmeliBasePage):
|
class LoginPage(AmeliBasePage):
|
||||||
def login(self, login, password):
|
def login(self, login, password):
|
||||||
self.browser.select_form('connexionCompteForm')
|
self.browser.select_form('connexionCompteForm')
|
||||||
|
|
@ -42,8 +44,8 @@ class LoginPage(AmeliBasePage):
|
||||||
self.browser["connexioncompte_2codeConfidentiel"] = password.encode('utf8')
|
self.browser["connexioncompte_2codeConfidentiel"] = password.encode('utf8')
|
||||||
self.browser.submit()
|
self.browser.submit()
|
||||||
|
|
||||||
class HomePage(AmeliBasePage):
|
|
||||||
|
|
||||||
|
class HomePage(AmeliBasePage):
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
@ -70,8 +72,8 @@ class AccountPage(AmeliBasePage):
|
||||||
sub.subscriber = unicode(name)
|
sub.subscriber = unicode(name)
|
||||||
yield sub
|
yield sub
|
||||||
|
|
||||||
class LastPaymentsPage(AmeliBasePage):
|
|
||||||
|
|
||||||
|
class LastPaymentsPage(AmeliBasePage):
|
||||||
def iter_last_payments(self):
|
def iter_last_payments(self):
|
||||||
list_table = self.document.xpath('//table[@id="ligneTabDerniersPaiements"]')
|
list_table = self.document.xpath('//table[@id="ligneTabDerniersPaiements"]')
|
||||||
if len(list_table) > 0:
|
if len(list_table) > 0:
|
||||||
|
|
@ -82,8 +84,8 @@ class LastPaymentsPage(AmeliBasePage):
|
||||||
continue
|
continue
|
||||||
yield list_a[0].attrib.get('href')
|
yield list_a[0].attrib.get('href')
|
||||||
|
|
||||||
class PaymentDetailsPage(AmeliBasePage):
|
|
||||||
|
|
||||||
|
class PaymentDetailsPage(AmeliBasePage):
|
||||||
def iter_payment_details(self, sub):
|
def iter_payment_details(self, sub):
|
||||||
if sub._id.isdigit():
|
if sub._id.isdigit():
|
||||||
idx = 0
|
idx = 0
|
||||||
|
|
@ -100,7 +102,7 @@ class PaymentDetailsPage(AmeliBasePage):
|
||||||
line = 1
|
line = 1
|
||||||
last_date = None
|
last_date = None
|
||||||
for tr in table:
|
for tr in table:
|
||||||
tds = tr.xpath('.//td');
|
tds = tr.xpath('.//td')
|
||||||
if len(tds) == 0:
|
if len(tds) == 0:
|
||||||
continue
|
continue
|
||||||
date_str = tds[0].text
|
date_str = tds[0].text
|
||||||
|
|
@ -118,8 +120,8 @@ class PaymentDetailsPage(AmeliBasePage):
|
||||||
line = line + 1
|
line = line + 1
|
||||||
yield det
|
yield det
|
||||||
|
|
||||||
class BillsPage(AmeliBasePage):
|
|
||||||
|
|
||||||
|
class BillsPage(AmeliBasePage):
|
||||||
def iter_bills(self, sub):
|
def iter_bills(self, sub):
|
||||||
table = self.document.xpath('//table[@id="tableauDecompte"]')[0].xpath('.//tr')
|
table = self.document.xpath('//table[@id="tableauDecompte"]')[0].xpath('.//tr')
|
||||||
for tr in table:
|
for tr in table:
|
||||||
|
|
@ -145,4 +147,3 @@ class BillsPage(AmeliBasePage):
|
||||||
|
|
||||||
def get_bill(self, bill):
|
def get_bill(self, bill):
|
||||||
self.location(bill._url, urllib.urlencode(bill._args))
|
self.location(bill._url, urllib.urlencode(bill._args))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue