示例#1
0
文件: pages.py 项目: dermorz/weboob
 def iter_orders(self):
     for id_ in self.doc.xpath(
             u'//span[contains(text(),"Order #")]/../span[2]/text()'):
         yield self.browser.to_order(id_.strip())
     for next_ in self.doc.xpath(u'//ul[@class="a-pagination"]'
                                 u'//a[contains(text(),"Next")]/@href'):
         raise NextPage(next_)
示例#2
0
    def iter_documents(self, subscription):
        next_page = None
        try:
            form = self.get_form('//input[@id="id_btn_valider"]/parent::form')
            next_yr = self.doc.xpath(
                '//select[@name="annee"]/option[@selected]/following-sibling::option'
            )
            if len(next_yr):
                form["annee"] = Attr(".", "value")(next_yr[0])
                next_page = form.request
        except FormNotFound:
            pass

        empty = self.doc.xpath('//text()[contains(., "Aucun volet social")]')

        if not empty:

            frm = self.doc.xpath('//input[@id="modeGarde"]/parent::form')[0]

            d = Document()

            d._annee = CleanText(Attr('.//input[@id="annee"]', "value"))(frm)
            d.id = "%s_%s" % (subscription.id, d._annee)
            d.date = parse_french_date("%s-12-31" % d._annee)
            d.label = "Attestation fiscale %s" % (d._annee)
            d.type = DocumentTypes.OTHER
            d.format = "pdf"
            d.url = Link("./table//div/a")(frm)

            yield d

        if next_page:
            raise NextPage(next_page)
示例#3
0
文件: pages.py 项目: guix77/weboob
 def get_link(self, account_id, owner):
     for tr in self.doc.xpath('//tr'):
         link = tr.xpath('.//a[replace(@title, " ", "") = $id]/@href', id=account_id)
         if not link:
             continue
         if CleanText('.//td[1]')(tr) != owner:
             continue
         yield link[0]
         return
     else:
         next_page = self.doc.xpath('//table[@id="tgDecorationFoot"]//b/following-sibling::a[1]/@href')
         if next_page:
             raise NextPage(next_page[0])
示例#4
0
    def check_next_page(self):
        if not hasattr(self, 'next_page'):
            return

        next_page = getattr(self, 'next_page')
        try:
            value = self.use_selector(next_page)
        except (AttributeNotFound, XPathNotFound):
            return

        if value is None:
            return

        raise NextPage(value)
示例#5
0
    def iter_history(self, data):
        for hist in self.doc['operationsIndividuelles']:
            if len(hist['instructions']) > 0:
                if 'nomDispositif' in hist['instructions'][0] and \
                   hist['instructions'][0]['nomDispositif'] + hist['instructions'][0]['codeDispositif'] == data['acc'].label + data['acc'].id:
                    tr = Transaction()
                    tr.amount = Decimal(hist['montantNet']) + Decimal(
                        hist['montantNetAbondement'])
                    tr.rdate = datetime.strptime(
                        hist['dateComptabilisation'].split('T')[0], '%Y-%m-%d')
                    tr.date = tr.rdate
                    tr.label = hist[
                        'libelleOperation'] if 'libelleOperation' in hist else hist[
                            'libelleCommunication']
                    tr.type = Transaction.TYPE_UNKNOWN
                    yield tr

        if data['total'] > data['params']['limit'] * (
                data['params']['offset'] + 1):
            offset = data['params']['offset']
            self.url = self.url.replace('&offset=' + str(offset),
                                        '&offset=' + str(offset + 1))
            data['params']['offset'] += 1
            raise NextPage(self.url)
示例#6
0
    def iter_history(self, data):
        for hist in self.doc['operationsIndividuelles']:
            if len(hist['instructions']) > 0:
                if self.belongs(hist['instructions'], data):
                    tr = Transaction()
                    tr.amount = self.get_amount(hist['instructions'], data)
                    tr.rdate = datetime.strptime(
                        hist['dateComptabilisation'].split('T')[0], '%Y-%m-%d')
                    tr.date = tr.rdate
                    tr.label = hist[
                        'libelleOperation'] if 'libelleOperation' in hist else hist[
                            'libelleCommunication']
                    tr.type = Transaction.TYPE_UNKNOWN

                    # Bypassed because we don't have the ISIN code
                    # tr.investments = []
                    # for ins in hist['instructions']:
                    #     inv = Investment()
                    #     inv.code = NotAvailable
                    #     inv.label = ins['nomFonds']
                    #     inv.description = ' '.join([ins['type'], ins['nomDispositif']])
                    #     inv.vdate = datetime.strptime(ins.get('dateVlReel', ins.get('dateVlExecution')).split('T')[
                    # 0], '%Y-%m-%d')
                    #     inv.valuation = Decimal(ins['montantNet'])
                    #     inv.quantity = Decimal(ins['nombreDeParts'])
                    #     inv.unitprice = inv.unitvalue = Decimal(ins['vlReel'])
                    #     tr.investments.append(inv)

                    yield tr
        if data['total'] > data['params']['limit'] * (
                data['params']['offset'] + 1):
            offset = data['params']['offset']
            self.url = self.url.replace('&offset=' + str(offset),
                                        '&offset=' + str(offset + 1))
            data['params']['offset'] += 1
            raise NextPage(self.url)