Add multiaccount support for history command

This commit is contained in:
Florent 2012-08-27 15:55:13 +02:00
commit c4f44361b6
3 changed files with 6 additions and 3 deletions

View file

@ -76,7 +76,7 @@ class Freemobile(BaseBrowser):
def get_history(self, subscription):
if not self.is_on_page(HistoryPage):
self.location('/moncompte/ajax.php?page=consotel_current_month', 'login=' + self.username)
self.location('/moncompte/ajax.php?page=consotel_current_month', 'login=' + subscription._login)
return self.page.get_calls(subscription)
def get_details(self, subscription):

View file

@ -111,7 +111,6 @@ class DetailsPage(BasePage):
return voice
def get_details(self, subscription):
print self.details
num = self.details['num' + subscription.id]
return self.details[num]

View file

@ -30,9 +30,12 @@ class HomePage(BasePage):
def get_list(self):
l = []
for divabo in self.document.xpath('//div[@class="idAbonne pointer"]'):
for divglobal in self.document.xpath('//div[@class="abonne"]'):
login = divglobal.xpath('//div[@class="acceuil_btn"]/a')[0].attrib['href'].split('l=')[1]
divabo = divglobal.xpath('div[@class="idAbonne pointer"]')[0]
owner = unicode(divabo.xpath('p')[0].text.replace(' - ', ''))
phone = unicode(divabo.xpath('p/span')[0].text)
self.browser.logger.debug('Found ' + login + ' as subscription identifier')
self.browser.logger.debug('Found ' + owner + ' as subscriber')
self.browser.logger.debug('Found ' + phone + ' as phone number')
phoneplan = unicode(self.document.xpath('//div[@class="forfaitChoisi"]')[0].text.lstrip().rstrip())
@ -41,5 +44,6 @@ class HomePage(BasePage):
subscription = Subscription(phone)
subscription.label = phone + ' - ' + phoneplan
subscription.subscriber = owner
subscription._login = login
yield subscription