Ejemplo n.º 1
0
    def iter_bills(self):
        table = self.document.xpath(
            '//table[@id="releveCompteMensuel"]')[0].xpath('.//tr')
        for tr in table:
            list_tds = tr.xpath('.//td')
            if len(list_tds) == 0:
                continue

            date_str = tr.xpath('.//td[@class="cAlignGauche"]')[0].text
            month_str = date_str.split()[0]
            date = datetime.strptime(
                re.sub(month_str, str(FRENCH_MONTHS.index(month_str) + 1),
                       date_str), "%m %Y").date()
            amount = tr.xpath('.//td[@class="cAlignDroite"]')[0].text
            for format in ('CSV', 'PDF'):
                bil = Bill()
                bil.id = date.strftime("%Y%m") + format
                bil.date = date
                bil.label = u'' + amount.strip()
                bil.format = u'' + format
                filedate = date.strftime("%m%Y")
                bil._url = '/PortailPS/fichier.do'
                bil._args = {
                    'FICHIER.type': format.lower() + '.releveCompteMensuel',
                    'dateReleve': filedate,
                    'FICHIER.titre': '',
                }
                yield bil
Ejemplo n.º 2
0
 def iter_bills(self, sub):
     table = self.document.xpath('//table[@id="tableauDecompte"]')[0].xpath(
         './/tr')
     for tr in table:
         list_tds = tr.xpath('.//td')
         if len(list_tds) == 0:
             continue
         date_str = list_tds[0].text
         month_str = date_str.split()[0]
         date = datetime.strptime(
             re.sub(month_str, str(FRENCH_MONTHS.index(month_str) + 1),
                    date_str), "%m %Y").date()
         amount = list_tds[1].text
         if amount is None:
             continue
         amount = re.sub(' euros', '', amount)
         bil = Bill()
         bil.id = sub._id + "." + date.strftime("%Y%m")
         bil.date = date
         bil.label = u'' + amount.strip()
         bil.format = u'pdf'
         filedate = date.strftime("%m%Y")
         bil._url = '/PortailAS/PDFServletReleveMensuel.dopdf'
         bil._args = {'PDF.moisRecherche': filedate}
         yield bil
Ejemplo n.º 3
0
 def iter_bills(self, sub):
     table = self.document.xpath('//table[@id="tableauDecompte"]')[0].xpath('.//tr')
     for tr in table:
         list_tds = tr.xpath('.//td')
         if len(list_tds) == 0:
             continue
         date_str = list_tds[0].text
         month_str = date_str.split()[0]
         date = datetime.strptime(re.sub(month_str, str(FRENCH_MONTHS.index(month_str) + 1), date_str), "%m %Y").date()
         amount = list_tds[1].text
         if amount is None:
             continue
         amount = re.sub(' euros', '', amount)
         bil = Bill()
         bil.id = sub._id + "." + date.strftime("%Y%m")
         bil.date = date
         bil.label = u''+amount.strip()
         bil.format = u'pdf'
         filedate = date.strftime("%m%Y")
         bil._url = '/PortailAS/PDFServletReleveMensuel.dopdf'
         bil._args = {'PDF.moisRecherche': filedate}
         yield bil
Ejemplo n.º 4
0
    def iter_bills(self):
        table = self.document.xpath('//table[@id="releveCompteMensuel"]')[0].xpath('.//tr')
        for tr in table:
            list_tds = tr.xpath('.//td')
            if len(list_tds) == 0:
                continue

            date_str = tr.xpath('.//td[@class="cAlignGauche"]')[0].text
            month_str = date_str.split()[0]
            date = datetime.strptime(re.sub(month_str, str(FRENCH_MONTHS.index(month_str) + 1), date_str), "%m %Y").date()
            amount = tr.xpath('.//td[@class="cAlignDroite"]')[0].text
            for format in ('CSV', 'PDF'):
                bil = Bill()
                bil.id = date.strftime("%Y%m") + format
                bil.date = date
                bil.label = u''+amount.strip()
                bil.format = u''+format
                filedate = date.strftime("%m%Y")
                bil._url = '/PortailPS/fichier.do'
                bil._args = {'FICHIER.type': format.lower() + '.releveCompteMensuel',
                             'dateReleve': filedate,
                             'FICHIER.titre': '',
                }
                yield bil