• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python bill.Detail类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: on_loaded

    def on_loaded(self):
        self.calls = []
        for tr in self.document.xpath('//tr'):
            tds = tr.xpath('td')
            if tds[0].text is None or tds[0].text == "Date":
                pass
            else:
                detail = Detail()
                mydate = date(*reversed([int(x) for x in tds[0].text.split(' ')[0].split("/")]))
                mytime = time(*[int(x) for x in tds[0].text.split(' ')[2].split(":")])
                detail.datetime = datetime.combine(mydate, mytime)
                detail.label = u' '.join([unicode(td.text.strip()) for td in tds[1:4] if td.text is not None])
                try:
                    detail.price = Decimal(tds[4].text[0:4].replace(',', '.'))
                except:
                    detail.price = Decimal(0)

                self.calls.append(detail)
开发者ID:blckshrk,项目名称:Weboob,代码行数:18,代码来源:history.py


示例17: _iter_divs

    def _iter_divs(self, divs, num, inter=False):
        for div in divs:
            detail = Detail()
            detail.label = CleanText('div[@class="titre"]/p')(div)
            detail.id = "-" + detail.label.split(' ')[1].lower()
            if inter:
                detail.label = detail.label + u" (international)"
                detail.id = detail.id + "-inter"
            detail.infos = CleanText('div[@class="conso"]/p')(div)
            detail.price = CleanDecimal('div[@class="horsForfait"]/p/span', default=Decimal(0), replace_dots=True)(div)
            detail.currency = Currency('div[@class="horsForfait"]/p/span')(div)

            self.details[num].append(detail)
开发者ID:laurentb,项目名称:weboob,代码行数:13,代码来源:history.py


示例18: iter_history

 def iter_history(self):
     tables = self.doc.xpath('//table[contains(concat(" ", @class, " "), " cTableauTriable ")]')
     if len(tables) > 0:
         lines = tables[0].xpath('.//tr')
         sno = 0
         for tr in lines:
             list_a = tr.xpath('.//a')
             if len(list_a) == 0:
                 continue
             date = tr.xpath('.//td')[0].text.strip()
             lot = list_a[0].text.replace('(*)', '').strip()
             if lot == 'SNL':
                 sno = sno + 1
                 lot = lot + str(sno)
             factures = tr.xpath('.//div[@class="cAlignGauche"]/a')
             factures_lbl = ''
             for a in factures:
                 factures_lbl = factures_lbl + a.text.replace('(**)', '').strip() + ' '
             montant = tr.xpath('.//div[@class="cAlignDroite"]')[0].text.strip()
             det = Detail()
             det.id = u''+lot
             det.label = u''+lot
             det.infos = u''+factures_lbl
             det.datetime = datetime.strptime(date, "%d/%m/%Y").date()
             det.price = Decimal(montant.replace(',', '.'))
             yield det
开发者ID:ffourcot,项目名称:weboob,代码行数:26,代码来源:pages.py


示例19: _parse_voice

    def _parse_voice(self, div, string, num, inter=False):
        voicediv = div.xpath('div[@class="conso"]')[0]
        voice = Detail()
        voice.id = "-voice"
        voice.label = CleanText('div[@class="titre"]/p')(div)
        if inter:
            voice.label = voice.label + " (international)"
            voice.id = voice.id + "-inter"
        voice.price = CleanDecimal('div[@class="horsForfait"]/p/span', default=Decimal(0), replace_dots=True)(div)
        voice.currency = Currency('div[@class="horsForfait"]/p/span')(div)
        voice1 = CleanText('.//span[@class="actif"][1]')(voicediv)
        voice2 = CleanText('.//span[@class="actif"][2]')(voicediv)
        voice.infos = unicode(string) % (voice1, voice2)

        return voice
开发者ID:laurentb,项目名称:weboob,代码行数:15,代码来源:history.py


示例20: get_details

    def get_details(self):
        txt = self._parse_pdf()
        page = txt.split('CONSOMMATION')[2].split('ACTIVITE DETAILLEE')[0]
        lines = page.split('\n')
        lines = [x for x in lines if len(x) > 0]  # Remove empty lines
        numitems = ((len(lines) + 1) / 3) - 1 # Each line has three columns, remove one element (pictures)
        lines.insert(len(lines) - 1, '')  # Add an empty column for "Prélèvement mensuel
        lines.pop(0)
        details = []
        for i in range(numitems):
            nature = i * 3
            conso = nature + 1
            price = conso + 1

            detail = Detail()
            detail.label = unicode(lines[nature], encoding='utf-8')
            detail.infos = unicode(lines[conso], encoding='utf-8')
            try:
                detail.price = Decimal(lines[price].replace('€', ''))
            except:
                detail.price = Decimal(0)
            details.append(detail)
        return details
开发者ID:eirmag,项目名称:weboob,代码行数:23,代码来源:history.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python housing.Query类代码示例发布时间:2022-05-26
下一篇:
Python base.find_object函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap