Search bills on freemobile
This commit is contained in:
parent
749162188d
commit
c890fe26d7
3 changed files with 26 additions and 6 deletions
|
|
@ -68,11 +68,15 @@ class FreeMobileBackend(BaseBackend, ICapBill):
|
||||||
for history in self.browser.get_history():
|
for history in self.browser.get_history():
|
||||||
yield history
|
yield history
|
||||||
|
|
||||||
def get_get_bill(self, subscription, id):
|
def get_bill(self, subscription, id):
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
|
||||||
def iter_bill(self, subscription):
|
def iter_bills(self, subscription):
|
||||||
raise NotImplementedError()
|
with self.browser:
|
||||||
|
sub = self.get_subscription(subscription)
|
||||||
|
for bill in self.browser.iter_bills():
|
||||||
|
bill.idparent = sub.id
|
||||||
|
yield bill
|
||||||
|
|
||||||
# The subscription is actually useless, but maybe for the futur...
|
# The subscription is actually useless, but maybe for the futur...
|
||||||
def get_details(self, subscription):
|
def get_details(self, subscription):
|
||||||
|
|
|
||||||
|
|
@ -83,5 +83,9 @@ class Freemobile(BaseBrowser):
|
||||||
def get_details(self):
|
def get_details(self):
|
||||||
if not self.is_on_page(DetailsPage):
|
if not self.is_on_page(DetailsPage):
|
||||||
self.location('/moncompte/index.php?page=suiviconso')
|
self.location('/moncompte/index.php?page=suiviconso')
|
||||||
test = self.page.get_details()
|
return self.page.get_details()
|
||||||
return test
|
|
||||||
|
def iter_bills(self):
|
||||||
|
if not self.is_on_page(DetailsPage):
|
||||||
|
self.location('/moncompte/index.php?page=suiviconso')
|
||||||
|
return self.page.date_bills()
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
|
|
||||||
from weboob.tools.browser import BasePage
|
from weboob.tools.browser import BasePage
|
||||||
from weboob.capabilities.bill import Detail
|
from weboob.capabilities.bill import Detail, Bill
|
||||||
from datetime import datetime, date, time
|
from datetime import datetime, date, time
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -37,6 +37,7 @@ def convert_price(div):
|
||||||
|
|
||||||
class DetailsPage(BasePage):
|
class DetailsPage(BasePage):
|
||||||
details = []
|
details = []
|
||||||
|
datebills = []
|
||||||
|
|
||||||
def on_loaded(self):
|
def on_loaded(self):
|
||||||
|
|
||||||
|
|
@ -57,6 +58,14 @@ class DetailsPage(BasePage):
|
||||||
divint = self.document.xpath('//div[@class="international hide"]')[0]
|
divint = self.document.xpath('//div[@class="international hide"]')[0]
|
||||||
self.iter_divs(divint.xpath('div[@class="detail"]'), True)
|
self.iter_divs(divint.xpath('div[@class="detail"]'), True)
|
||||||
|
|
||||||
|
for trbill in self.document.xpath('//tr[@class="derniereFacture"]'):
|
||||||
|
mydate = trbill.find('td/input').attrib['onclick'].split("'")[1]
|
||||||
|
bill = Bill()
|
||||||
|
bill.label = mydate
|
||||||
|
bill.date = date(int(mydate[0:4]), int(mydate[4:6]), int(mydate[6:8]))
|
||||||
|
bill.format = 'html'
|
||||||
|
self.datebills.append(bill)
|
||||||
|
|
||||||
def iter_divs(self, divs, inter=False):
|
def iter_divs(self, divs, inter=False):
|
||||||
for div in divs:
|
for div in divs:
|
||||||
detail = Detail()
|
detail = Detail()
|
||||||
|
|
@ -72,6 +81,9 @@ class DetailsPage(BasePage):
|
||||||
def get_details(self):
|
def get_details(self):
|
||||||
return self.details
|
return self.details
|
||||||
|
|
||||||
|
def date_bills(self):
|
||||||
|
return self.datebills
|
||||||
|
|
||||||
|
|
||||||
def _get_date(detail):
|
def _get_date(detail):
|
||||||
return detail.datetime
|
return detail.datetime
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue