当前位置: 首页>>代码示例>>Python>>正文


Python bill.Detail类代码示例

本文整理汇总了Python中weboob.capabilities.bill.Detail的典型用法代码示例。如果您正苦于以下问题:Python Detail类的具体用法?Python Detail怎么用?Python Detail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Detail类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: iter_details

 def iter_details(self, sub):
     det = Detail()
     det.id = sub.id
     det.label = sub.label
     det.infos = ''
     det.price = Decimal('0.0')
     yield det
开发者ID:Konubinix,项目名称:weboob,代码行数:7,代码来源:browser.py

示例2: get_details

 def get_details(self, sub):
     det = Detail()
     det.id = sub.id
     det.label = sub.label
     det.infos = ''
     det.price = Decimal('0.0')
     return det
开发者ID:laurentb,项目名称:weboob,代码行数:7,代码来源:browser.py

示例3: get_details

 def get_details(self, sub):
     det = Detail()
     det.id = sub.id
     det.label = sub.label
     det.infos = ""
     det.price = Decimal("0.0")
     return det
开发者ID:pombredanne,项目名称:weboob,代码行数:7,代码来源:browser.py

示例4: get_balance

 def get_balance(self):
     for calls in self.get_calls():
         if "Votre solde" in calls.label:
             detail = Detail()
             detail.price = calls.price
             detail.label = u"Balance"
             return detail
开发者ID:Boussadia,项目名称:weboob,代码行数:7,代码来源:history.py

示例5: iter_details

 def iter_details(self, sub):
     det = Detail()
     det.id = sub.id
     det.label = sub.label
     det.infos = ""
     det.price = Decimal("0.0")
     yield det
开发者ID:hugues,项目名称:weboob,代码行数:7,代码来源:browser.py

示例6: do_details

    def do_details(self, id):
        """
        details [ID]

        Get details of subscriptions.
        If no ID given, display all details of all backends.
        """
        l = []
        id, backend_name = self.parse_id(id)

        if not id:
            for subscrib in self.get_object_list('iter_subscription'):
                l.append((subscrib.id, subscrib.backend))
        else:
            l.append((id, backend_name))

        for id, backend in l:
            names = (backend,) if backend is not None else None
            # XXX: should be generated by backend? -Flo
            # XXX: no, but you should do it in a specific formatter -romain
            # TODO: do it, and use exec_method here. Code is obsolete
            mysum = Detail()
            mysum.label = u"Sum"
            mysum.infos = u"Generated by boobill"
            mysum.price = Decimal("0.")

            self.start_format()
            for detail in self.do('get_details', id, backends=names):
                self.format(detail)
                mysum.price = detail.price + mysum.price

            self.format(mysum)
开发者ID:frankrousseau,项目名称:weboob,代码行数:32,代码来源:boobill.py

示例7: get_calls

    def get_calls(self):
        txt = self._parse_pdf()
        pages = txt.split("DEBIT")
        pages.pop(0)  # remove headers
        details = []
        for page in pages:
            page = page.split("RÉGLO MOBILE")[0].split("N.B. Prévoir")[0]  # remove footers
            lines = page.split("\n")
            lines = [x for x in lines if len(x) > 0]  # Remove empty lines
            numitems = (len(lines) + 1) / 4  # Each line has five columns
            lines.pop(0)  # remove the extra € symbol
            modif = 0
            i = 0
            while i < numitems:
                if modif != 0:
                    numitems = (len(lines) + 1 + modif) / 4
                base = i * 4 - modif
                dateop = base
                corres = base + 1
                duree = base + 2
                price = base + 3
                if "Changement vers le Forfait" in lines[base]:
                    modif += 1
                    i += 1
                    continue
                # Special case with 5 columns, the operation date is not in the first one
                if len(re.split("(\d+\/\d+\/\d+)", lines[dateop])) < 2:
                    lines[base + 1] = lines[base] + " " + lines[base + 1]
                    dateop = base + 1
                    corres = base + 2
                    duree = base + 3
                    price = base + 4
                    modif -= 1
                detail = Detail()
                splits = re.split("(\d+\/\d+\/\d+)", lines[dateop])
                mydate = date(*reversed([int(x) for x in splits[1].split("/")]))
                mytime = time(*[int(x) for x in splits[2].split(":")])
                detail.datetime = datetime.combine(mydate, mytime)
                if lines[corres] == "-":
                    lines[corres] = ""
                if lines[duree] == "-":
                    lines[duree] = ""
                detail.label = (
                    unicode(splits[0], encoding="utf-8", errors="replace") + u" " + lines[corres] + u" " + lines[duree]
                )
                # Special case with only 3 columns, we insert a price
                if "Activation de votre ligne" in detail.label:
                    lines.insert(price, "0")
                try:
                    detail.price = Decimal(lines[price].replace(",", "."))
                except:
                    # In some special cases, there are no price column. Try to detect it
                    if "Inclus" not in lines[price]:
                        modif += 1
                    detail.price = Decimal(0)

                details.append(detail)
                i += 1
        return sorted(details, key=_get_date, reverse=True)
开发者ID:pombredanne,项目名称:weboob,代码行数:59,代码来源:history.py

示例8: iter_details

 def iter_details(self, sub):
     self.logger.debug('call Browser.iter_details')
     det = Detail()
     det.id = sub.id
     det.label = sub.label
     det.infos = ''
     det.price = Decimal('0.0')
     yield det
开发者ID:ngrislain,项目名称:weboob,代码行数:8,代码来源:browser.py

示例9: get_balance

 def get_balance(self, subscription):
     if not isinstance(subscription, Subscription):
         subscription = self.get_subscription(subscription)
     balance = Detail()
     balance.price = subscription._balance
     balance.label = u"Balance"
     balance.currency = Currency.CUR_EUR
     return balance
开发者ID:lissyx,项目名称:weboob,代码行数:8,代码来源:backend.py

示例10: get_balance

 def get_balance(self, subscription):
     if not isinstance(subscription, Subscription):
         subscription = self.get_subscription(subscription)
     balance = Detail()
     balance.id = "%s-balance" % subscription.id
     balance.price = subscription._balance
     balance.label = u"Balance %s" % subscription.id
     balance.currency = u'EUR'
     return balance
开发者ID:P4ncake,项目名称:weboob,代码行数:9,代码来源:module.py

示例11: get_calls

    def get_calls(self):
        txt = self._parse_pdf()
        pages = txt.split("DEBIT")
        pages.pop(0)  # remove headers
        details = []
        for page in pages:
            page = page.split('RÉGLO MOBILE')[0].split('N.B. Prévoir')[0]  # remove footers
            lines = page.split('\n')
            lines = [x for x in lines if len(x) > 0]  # Remove empty lines
            numitems = (len(lines) + 1) / 4  # Each line has five columns
            lines.pop(0)
            modif = 0
            i = 0
            while i < numitems:
                if modif != 0:
                    numitems = ((len(lines) + 1 + modif) / 4)
                nature = i * 4 - modif
                dateop = nature
                corres = nature + 1
                duree = corres + 1
                price = duree + 1
                if "Changement vers le Forfait" in lines[nature]:
                    modif += 1
                    i += 1
                    continue
                if len(re.split("(\d+\/\d+\/\d+)", lines[dateop])) < 2:
                    lines[nature + 1] = lines[nature] + " " + lines[nature + 1]
                    dateop = nature + 1
                    corres = dateop + 1
                    duree = corres + 1
                    price = duree + 1
                    modif -= 1
                if not lines[corres][0:3].isdigit() and not lines[corres][0:3] == "-":
                    modif += 1
                detail = Detail()
                splits = re.split("(\d+\/\d+\/\d+)", lines[dateop])
                mydate = date(*reversed([int(x) for x in splits[1].split("/")]))
                mytime = time(*[int(x) for x in splits[2].split(":")])
                detail.datetime = datetime.combine(mydate, mytime)
                if lines[corres] == '-':
                    lines[corres] = ""
                if lines[duree] == '-':
                    lines[duree] = ''
                detail.label = unicode(splits[0], encoding='utf-8', errors='replace') + u" " + lines[corres] + u" " + lines[duree]
                # Special case with only 3 columns, we insert a price
                if "Activation de votre ligne" in detail.label:
                    lines.insert(price, '0')
                try:
                    detail.price = Decimal(lines[price].replace(',', '.'))
                except:
                    detail.price = Decimal(0)

                details.append(detail)
                i += 1
        return sorted(details, key=_get_date, reverse=True)
开发者ID:blckshrk,项目名称:Weboob,代码行数:55,代码来源:history.py

示例12: get_balance

 def get_balance(self):
     if not self.is_on_page(HistoryPage):
         self.location(self.conso)
     detail = Detail()
     detail.label = u"Balance"
     for calls in self.get_history():
         if "Votre solde" in calls.label:
             detail.price = calls.price
             return detail
     detail.price = NotAvailable
     return detail
开发者ID:Konubinix,项目名称:weboob,代码行数:11,代码来源:browser.py

示例13: iter_payment_details

 def iter_payment_details(self, sub):
     if sub._id.isdigit():
         idx = 0
     else:
         idx = sub._id.replace('AFFILIE', '')
     if len(self.document.xpath('//div[@class="centrepage"]/h2')) > idx or self.document.xpath('//table[@id="DetailPaiement3"]') > idx:
         id_str = self.document.xpath('//div[@class="centrepage"]/h2')[idx].text.strip()
         m = re.match('.*le (.*) pour un montant de.*', id_str)
         if m:
             id_str = m.group(1)
             id_date = datetime.strptime(id_str, '%d/%m/%Y').date()
             id = sub._id + "." + datetime.strftime(id_date, "%Y%m%d")
             table = self.document.xpath('//table[@class="tableau"]')[idx].xpath('.//tr')
             line = 1
             last_date = None
             for tr in table:
                 tds = tr.xpath('.//td')
                 if len(tds) == 0:
                     continue
                 date_str = tds[0].text
                 det = Detail()
                 det.id = id + "." + str(line)
                 det.label = unicode(tds[1].text.strip())
                 if date_str is None or date_str == '':
                     det.infos = u''
                     det.datetime = last_date
                 else:
                     det.infos = u'Payé ' + unicode(re.sub('[^\d,-]+', '', tds[2].text)) + u'€ / Base ' + unicode(re.sub('[^\d,-]+', '', tds[3].text)) + u'€ / Taux ' + unicode(re.sub('[^\d,-]+', '', tds[4].text)) + '%'
                     det.datetime = datetime.strptime(date_str, '%d/%m/%Y').date()
                     last_date = det.datetime
                 det.price = Decimal(re.sub('[^\d,-]+', '', tds[5].text).replace(',', '.'))
                 line = line + 1
                 yield det
开发者ID:juliaL03,项目名称:weboob,代码行数:33,代码来源:pages.py

示例14: on_loaded

    def on_loaded(self):
        self.details = []
        table = self.document.xpath('//table[@id="reportTable"]')[0]

        for tr in table.xpath('tbody/tr'):
            detail = Detail()
            # Skip global category
            if tr.find('td/a') is not None:
                continue
            if tr.attrib["class"] == "totalAmount":
                continue
            tds = tr.xpath('td')
            detail.label = unicode(tds[0].text.strip())
            detail.infos = unicode(tds[1].text.strip())
            detail.price = Decimal(tds[2].text.split(' ')[0].replace(',', '.'))

            self.details.append(detail)
开发者ID:eirmag,项目名称:weboob,代码行数:17,代码来源:history.py

示例15: iter_payments

    def iter_payments(self, sub):

        table = self.browser.page.document.xpath('//table[contains(@summary, "Informations sur mon")]')[0]
        for tr in table.xpath('.//tr'):
            list_tds = tr.xpath('.//td')
            if len(list_tds) == 0:
                continue
            date = datetime.strptime(self.parser.tocleanstring(list_tds[0]), "%d/%m/%Y").date()
            amount = self.parser.tocleanstring(list_tds[1])
            if amount is None:
                continue
            det = Detail()
            det.id = sub._id + "." + date.strftime("%Y%m%d")
            det.price = Decimal(re.sub('[^\d,-]+', '', amount).replace(',', '.'))
            det.datetime = date
            det.label = unicode(self.parser.tocleanstring(list_tds[2]))
            yield det
开发者ID:juliaL03,项目名称:weboob,代码行数:17,代码来源:pages.py


注:本文中的weboob.capabilities.bill.Detail类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。