def iter_subscription_list(self): fullname = CleanText('//div[@id="bloc_contenu_masituation"]/h3', replace=[('Titulaire du compte : ', '') ])(self.doc) number = re.sub( '[^\d]+', '', self.doc.xpath('//div[@id="bloc_contenu_masituation"]/ul/li') [2].text) sub = Subscription(number) sub._id = number sub.label = unicode(fullname) firstname = Regexp(RawText('//div[@id="bloc_contenu_masituation"]/h3'), '\t([^\xa0\t]+)\xa0[^:]')(self.doc) sub.subscriber = unicode(firstname) yield sub nb_childs = 0 childs = self.doc.xpath('//div[@class="bloc_infos"]') for child in childs: fullname = CleanText('.//h3[1]')(child) nb_childs = nb_childs + 1 number = "AFFILIE" + str(nb_childs) sub = Subscription(number) sub._id = number sub.label = unicode(fullname) firstname = Regexp(RawText('./h3'), '\t([^\xa0\t]+)\xa0[^:]')(child) sub.subscriber = unicode(firstname) yield sub
def iter_subscription_list(self): names_list = self.doc.xpath('//span[@class="NomEtPrenomLabel"]') fullname = CleanText(newlines=True).filter(names_list[0]) number = re.sub('[^\d]+', '', CleanText('//span[@class="blocNumSecu"]', replace=[(' ','')])(self.doc)) sub = Subscription(number) sub._id = number sub.label = fullname firstname = CleanText('//span[@class="prenom-titulaire"]')(self.doc) sub.subscriber = firstname yield sub
def iter_subscription_list(self): name = CleanText('//div[@id="bloc_contenu_masituation"]/h3', replace=[('Titulaire du compte : ', '')])(self.doc) number = re.sub('[^\d]+', '', self.doc.xpath('//div[@id="bloc_contenu_masituation"]/ul/li')[2].text) sub = Subscription(number) sub._id = number sub.label = unicode(name) sub.subscriber = unicode(name) yield sub nb_childs = 0 childs = self.doc.xpath('//div[@class="bloc_infos"]') for child in childs: name = CleanText('.//h3[1]')(child) nb_childs = nb_childs + 1 number = "AFFILIE" + str(nb_childs) sub = Subscription(number) sub._id = number sub.label = unicode(name) sub.subscriber = unicode(name) yield sub
def iter_subscription_list(self): ident = self.doc.xpath('//div[@id="identification"]')[0] prof = self.doc.xpath('//div[@id="profession"]')[0] name = ident.xpath('//p/b')[0].text.replace(' ', ' ').strip() number = ident.xpath('//p')[1].text.replace('Cabinet', '').strip() label = prof.xpath('//div[@class="zoneTexte"]')[0].text.strip() sub = Subscription(number) sub._id = number sub.label = unicode(name) + ' ' + unicode(label) sub.subscriber = unicode(name) return sub
def get_subscription_list(self): ident = self.document.xpath('//div[@id="identification"]')[0] prof = self.document.xpath('//div[@id="profession"]')[0] name = ident.xpath('//p/b')[0].text.replace(' ', ' ').strip() number = ident.xpath('//p')[1].text.replace('Cabinet', '').strip() label = prof.xpath('//div[@class="zoneTexte"]')[0].text.strip() sub = Subscription(number) sub._id = number sub.label = unicode(name) + ' ' + unicode(label) sub.subscriber = unicode(name) return sub
def iter_subscription_list(self): boxHeader = self.document.xpath('//div[@class="boxHeader"]')[0] subscriber = self.parser.tocleanstring(boxHeader.xpath('.//p')[0]) contract = self.parser.tocleanstring(boxHeader.xpath('.//p[@class="folderNumber"]')[0]) if not re.search('^Contrat n\xb0\s*', contract): return contract = re.sub('Contrat n\xb0\s*', '', contract) number = re.sub('[^\d]', '', contract) sub = Subscription(number) sub._id = number sub.label = subscriber sub.subscriber = subscriber yield sub
def iter_subscription_list(self): names_list = self.doc.xpath('//span[@class="NomEtPrenomLabel"]') fullname = CleanText(newlines=True).filter(names_list[0]) number = re.sub( '[^\d]+', '', CleanText('//span[@class="blocNumSecu"]', replace=[(' ', '')])(self.doc)) sub = Subscription(number) sub._id = number sub.label = unicode(fullname) firstname = CleanText('//span[@class="prenom-titulaire"]')(self.doc) sub.subscriber = unicode(firstname) yield sub
def iter_subscription_list(self): idents = self.document.xpath('//div[contains(@class, "blocfond")]') enfants = 0 for ident in idents: if len(ident.xpath('.//h4')) == 0: continue name = self.parser.tocleanstring(ident.xpath('.//h4')[0]) lis = ident.xpath('.//li') if len(lis) > 3: number = re.sub('[^\d]+', '', ident.xpath('.//li')[3].text) else: enfants = enfants + 1 number = "AFFILIE" + str(enfants) sub = Subscription(number) sub._id = number sub.label = unicode(name) sub.subscriber = unicode(name) yield sub
def iter_subscription_list(self): idents = self.document.xpath('//div[contains(@class, "blocfond")]') enfants = 0 for ident in idents: if len(ident.xpath('.//h3')) == 0: continue name = self.parser.tocleanstring(ident.xpath('.//h3')[0]) lis = ident.xpath('.//li') if len(lis) > 3: number = re.sub('[^\d]+', '', ident.xpath('.//li')[3].text) else: enfants = enfants + 1 number = "AFFILIE" + str(enfants) sub = Subscription(number) sub._id = number sub.label = unicode(name) sub.subscriber = unicode(name) yield sub
def get_subscription_list(self): table = self.document.xpath('//table[@id="ensemble_contrat_N0"]')[0] if len(table) > 0: # some clients may have subscriptions to gas and electricity, # but they receive a single bill # to avoid "boobill details" and "boobill bills" returning the same # table twice, we could return only one subscription for both. # We do not, and "boobill details" will take care of parsing only the # relevant section in the bill files. for line in table[0].xpath('//tbody/tr'): cells = line.xpath('td') snumber = cells[2].attrib['id'].replace('Contrat_', '') slabel = cells[0].xpath('a')[0].text.replace('offre', '').strip() d = unicode(cells[3].xpath('strong')[0].text.strip()) sdate = date(*reversed([int(x) for x in d.split("/")])) sub = Subscription(snumber) sub._id = snumber sub.label = slabel sub.subscriber = unicode(cells[1]) sub.renewdate = sdate yield sub