Get renew date on freemobile
This commit is contained in:
parent
9585ba1284
commit
e35c7812ea
2 changed files with 17 additions and 1 deletions
|
|
@ -59,7 +59,11 @@ class Freemobile(BaseBrowser):
|
||||||
if not self.is_on_page(HomePage):
|
if not self.is_on_page(HomePage):
|
||||||
self.location('/moncompte/index.php?page=home')
|
self.location('/moncompte/index.php?page=home')
|
||||||
|
|
||||||
return self.page.get_list()
|
subscriptions = self.page.get_list()
|
||||||
|
self.location('/moncompte/index.php?page=suiviconso')
|
||||||
|
for subscription in subscriptions:
|
||||||
|
subscription.renewdate = self.page.get_renew_date(subscription)
|
||||||
|
yield subscription
|
||||||
|
|
||||||
def get_subscription(self, id):
|
def get_subscription(self, id):
|
||||||
assert isinstance(id, basestring)
|
assert isinstance(id, basestring)
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ class DetailsPage(BasePage):
|
||||||
virtualnumber = div.attrib['onclick'].split('(')[1][1]
|
virtualnumber = div.attrib['onclick'].split('(')[1][1]
|
||||||
self.details['num' + str(phonenumber)] = virtualnumber
|
self.details['num' + str(phonenumber)] = virtualnumber
|
||||||
|
|
||||||
|
|
||||||
for div in self.document.xpath('//div[@class="infosConso"]'):
|
for div in self.document.xpath('//div[@class="infosConso"]'):
|
||||||
num = div.attrib['id'].split('_')[1][0]
|
num = div.attrib['id'].split('_')[1][0]
|
||||||
self.details[num] = []
|
self.details[num] = []
|
||||||
|
|
@ -123,6 +124,17 @@ class DetailsPage(BasePage):
|
||||||
def date_bills(self):
|
def date_bills(self):
|
||||||
return self.datebills
|
return self.datebills
|
||||||
|
|
||||||
|
def get_renew_date(self, subscription):
|
||||||
|
div = self.document.xpath('//div[@class="resumeConso"]')[0]
|
||||||
|
mydate = div.xpath('span[@class="actif"]')[0].text
|
||||||
|
mydate = date(*reversed([int(x) for x in mydate.split("/")]))
|
||||||
|
if mydate.month == 12:
|
||||||
|
mydate = mydate.replace(month = 1)
|
||||||
|
mydate = mydate.replace(year= mydate.year + 1)
|
||||||
|
else:
|
||||||
|
mydate = mydate.replace(month = mydate.month + 1)
|
||||||
|
return mydate
|
||||||
|
|
||||||
|
|
||||||
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