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

Python date.parse_french_date函数代码示例

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

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



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

示例1: handle_response

    def handle_response(self, transfer):
        self.check_errors()
        transfer_data = self.doc['data']['enregistrementVirement']

        transfer.id = transfer_data['reference']
        transfer.exec_date = parse_french_date(self.doc['data']['enregistrementVirement']['dateExecution']).date()
        # Timestamp at which the bank registered the transfer
        register_date = re.sub(' 24:', ' 00:', self.doc['data']['enregistrementVirement']['dateEnregistrement'])
        transfer._register_date = parse_french_date(register_date)

        return transfer
开发者ID:laurentb,项目名称:weboob,代码行数:11,代码来源:pages.py


示例2: parse_transaction

 def parse_transaction(self, transaction, account):
     trans = []
     if transaction['transactionStatus'] in [u'Créé', u'Annulé', u'Suspendu', u'Mis à jour', u'Actif', u'Payé', u'En attente', u'Rejeté', u'Expiré', \
                                             u'Created']:
         return []
     if transaction['transactionDescription'].startswith(u'Offre de remboursement') or transaction['transactionDescription'].startswith(u'Commande à'):
         return []
     t = FrenchTransaction(transaction['transactionId'])
     if not transaction['transactionAmount']['currencyCode'] == account.currency:
         cc = self.browser.convert_amount(account, transaction, 'https://www.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' + transaction['transactionId'])
         if not cc:
             return []
         t.original_amount = Decimal('%.2f' % transaction['transactionAmount']['currencyDoubleValue'])
         t.original_currency = u'' + transaction['transactionAmount']['currencyCode']
         t.amount = abs(cc) if not transaction['debit'] else -abs(cc)
     else:
         t.amount = Decimal('%.2f' % transaction['net']['currencyDoubleValue'])
     date = parse_french_date(transaction['transactionTime'])
     raw = transaction['transactionDescription']
     if raw.startswith(u'Paiement \xe0') or raw.startswith('Achat de'):
         payback_id, payback_raw, payback_amount, payback_currency = self.browser.check_for_payback(transaction,  'https://www.paypal.com/cgi-bin/webscr?cmd=_history-details-from-hub&id=' + transaction['transactionId'])
         if payback_id and payback_raw and payback_amount and payback_currency:
             t_payback = FrenchTransaction(payback_id)
             t_payback.amount = payback_amount
             t_payback.original_currency = payback_currency
             t_payback.type = FrenchTransaction.TYPE_TRANSFER
             t_payback.parse(date=date, raw=u'Prélèvement pour %s' % raw)
             trans.append(t_payback)
     t.commission = Decimal('%.2f' % transaction['fee']['currencyDoubleValue'])
     t.parse(date=date, raw=raw)
     trans.append(t)
     return trans
开发者ID:ffourcot,项目名称:weboob,代码行数:32,代码来源:pages.py


示例3: iter_coming

 def iter_coming(self):
     for op in self.path('data.listerOperations.compte.operationAvenir.*.operation.*'):
         codeOperation = cast(op.get('codeOperation'), int, 0)
         # Coming transactions don't have real id
         tr = Transaction.from_dict({
             'type': self.COMING_TYPE_TO_TYPE.get(codeOperation) or Transaction.TYPE_UNKNOWN,
             'amount': op.get('montant'),
             'card': op.get('numeroPorteurCarte'),
         })
         tr.parse(date=parse_french_date(op.get('dateOperation')),
                  vdate=parse_french_date(op.get('valueDate')),
                  raw=op.get('libelle'))
         if tr.type == Transaction.TYPE_CARD:
             tr.type = self.browser.card_to_transaction_type.get(op.get('keyCarte'),
                                                                 Transaction.TYPE_DEFERRED_CARD)
         yield tr
开发者ID:laurentb,项目名称:weboob,代码行数:16,代码来源:pages.py


示例4: parse_datetime

    def parse_datetime(self, text):
        m = re.match('(\d+)/(\d+)/(\d+) (\d+):(\d+) (\w+)', text)
        if m:
            date = datetime.datetime(int(m.group(3)),
                                     int(m.group(1)),
                                     int(m.group(2)),
                                     int(m.group(4)),
                                     int(m.group(5)))
            if m.group(6) == 'pm':
                date += datetime.timedelta(0,12*3600)
            return date

        m = re.match('(\d+)-(\d+)-(\d+) (\d+):(\d+)', text)
        if m:
            return datetime.datetime(int(m.group(1)),
                                     int(m.group(2)),
                                     int(m.group(3)),
                                     int(m.group(4)),
                                     int(m.group(5)))

        m = re.match('(\d+) (\w+) (\d+) (\d+):(\d+)', text)
        if m:
            return parse_french_date(text)

        self.logger.warning('Unable to parse "%s"' % text)
        return text
开发者ID:frankrousseau,项目名称:weboob-modules,代码行数:26,代码来源:issues.py


示例5: parse_transaction

    def parse_transaction(self, transaction, account):
        t = FrenchTransaction(transaction['id'])
        if not transaction['isPrimaryCurrency']:
            original_currency = unicode(transaction['amounts']['txnCurrency'])
            if original_currency in self.browser.account_currencies:
                return []
            if 'conversionFrom' in transaction['amounts'] and account.currency == transaction['amounts']['conversionFrom']['currency']:
                cc = self.format_amount(transaction['amounts']['conversionFrom']['value'], transaction['isCredit'])
            else:
                try:
                    cc = self.browser.convert_amount(account, transaction, transaction['detailsLink'])
                except ServerError:
                    self.logger.warning('Unable to go on detail, transaction skipped.')
                    return []
            if not cc:
                return []
            t.original_amount = self.format_amount(transaction['amounts']['net']['value'], transaction["isCredit"])
            t.original_currency = original_currency
            t.amount = self.format_amount(cc, transaction['isCredit'])
        else:
            t.amount = self.format_amount(transaction['amounts']['net']['value'], transaction['isCredit'])
        date = parse_french_date(transaction['date']['formattedDate'] + ' ' + transaction['date']['year'])
        raw = transaction.get('counterparty', transaction['displayType'])
        t.parse(date=date, raw=raw)

        return [t]
开发者ID:dasimon,项目名称:weboob,代码行数:26,代码来源:pages.py


示例6: recap

    def recap(self, origin, recipient, transfer):
        error = CleanText(u'//div[@id="transfer_form:moveMoneyDetailsBody"]//span[@class="error"]', default=None)(self.doc) or \
                CleanText(u'//p[contains(text(), "Nous sommes désolés. Le solde de votre compte ne doit pas être inférieur au montant de votre découvert autorisé. Veuillez saisir un montant inférieur.")]', default=None)(self.doc)
        if error:
           raise TransferInvalidAmount(message=error)

        t = Transfer()
        t.label = transfer.label
        assert transfer.amount == CleanDecimal('//div[@id="transferSummary"]/div[@id="virementLabel"]\
        //label[@class="digits positive"]', replace_dots=True)(self.doc)
        t.amount = transfer.amount
        t.currency = FrenchTransaction.Currency('//div[@id="transferSummary"]/div[@id="virementLabel"]\
        //label[@class="digits positive"]')(self.doc)

        assert origin.label == CleanText('//div[@id="transferSummary"]/div[has-class("debit")]//span[@class="title"]')(self.doc)
        assert origin.balance == CleanDecimal('//div[@id="transferSummary"]/div[has-class("debit")]\
        //label[@class="digits positive"]', replace_dots=True)(self.doc)
        t.account_balance = origin.balance
        t.account_label = origin.label
        t.account_iban = origin.iban
        t.account_id = origin.id

        assert recipient.label == CleanText('//div[@id="transferSummary"]/div[has-class("credit")]//span[@class="title"]')(self.doc)
        t.recipient_label = recipient.label
        t.recipient_iban = recipient.iban
        t.recipient_id = recipient.id

        t.exec_date = parse_french_date(CleanText('//p[has-class("exec-date")]', children=False,
                replace=[('le', ''), (u'exécuté', ''), ('demain', ''), ('(', ''), (')', ''),
                ("aujourd'hui", '')])(self.doc)).date()

        return t
开发者ID:P4ncake,项目名称:weboob,代码行数:32,代码来源:transfer.py


示例7: parse

 def parse(self, el):
     label = CleanText('//div[contains(@class, "lister")]//p[@class="c"]')(el)
     if not label:
         return
     label = re.findall('(\d+ [^ ]+ \d+)', label)[-1]
     # use the trick of relativedelta to get the last day of month.
     self.env['debit_date'] = parse_french_date(label) + relativedelta(day=31)
开发者ID:nojhan,项目名称:weboob-devel,代码行数:7,代码来源:pages.py


示例8: get_history

    def get_history(self, date_guesser):
        seen = set()
        lines = self.document.xpath('(//table[@class="ca-table"])[2]/tr')
        for line in lines[1:]:  # first line is balance
            is_balance = line.xpath('./td/@class="cel-texte cel-neg"')

            [date, label, _, amount] = [self.parser.tocleanstring(td)
                                        for td in line.xpath('./td')]

            t = Transaction(0)
            t.set_amount(amount)
            t.label = t.raw = label

            if is_balance:
                m = re.search('(\d+ [^ ]+ \d+)', label)
                if not m:
                    raise BrokenPageError('Unable to read card balance in history: %r' % label)

                t.date = parse_french_date(m.group(1))
                t.amount = -t.amount
            else:
                day, month = map(int, date.split('/', 1))
                t.date = date_guesser.guess_date(day, month)

            t.type = t.TYPE_CARD
            t.rdate = t.date
            try:
                t.id = t.unique_id(seen)
            except UnicodeEncodeError:
                print t
                print t.label
                raise

            yield t
开发者ID:lissyx,项目名称:weboob,代码行数:34,代码来源:pages.py


示例9: obj_rdate

    def obj_rdate(self):
        raw = self.obj_raw()
        mtc = re.search(r'\bDU (\d{2})\.?(\d{2})\.?(\d{2})\b', raw)
        if mtc:
            date = '%s/%s/%s' % (mtc.group(1), mtc.group(2), mtc.group(3))
            return parse_french_date(date)

        return fromtimestamp(Dict('dateCreation')(self))
开发者ID:P4ncake,项目名称:weboob,代码行数:8,代码来源:pages.py


示例10: obj_date

 def obj_date(self):
     date = CleanText(
         './div/p[@class="item-date"]'
     )(self).split(" / ")
     if len(date) > 1:
         return parse_french_date(date[1].strip())
     else:
         return NotLoaded
开发者ID:P4ncake,项目名称:weboob,代码行数:8,代码来源:pages.py


示例11: iter_history

    def iter_history(self):
        for op in self.get('data.listerOperations.compte.operationPassee') or []:
            codeFamille = cast(self.one('operationType.codeFamille', op), int)
            tr = Transaction.from_dict({
                'id': op.get('idOperation'),
                'type': self.CODE_TO_TYPE.get(codeFamille) or Transaction.TYPE_UNKNOWN,
                'category': op.get('categorie'),
                'amount': self.one('montant.montant', op),
            })
            tr.parse(raw=op.get('libelleOperation'),
                     date=parse_french_date(op.get('dateOperation')),
                     vdate=parse_french_date(self.one('montant.valueDate', op)))

            raw_is_summary = re.match(r'FACTURE CARTE SELON RELEVE DU\b|FACTURE CARTE CARTE AFFAIRES \d{4}X{8}\d{4} SUIVANT\b', tr.raw)
            if tr.type == Transaction.TYPE_CARD and raw_is_summary:
                tr.type = Transaction.TYPE_CARD_SUMMARY
                tr.deleted = True
            yield tr
开发者ID:laurentb,项目名称:weboob,代码行数:18,代码来源:pages.py


示例12: get_operations

 def get_operations(self):
     for tr in self._get_operations(self)():
         tr.type = tr.TYPE_DEFERRED_CARD
         deferred_date = Regexp(CleanText('//div[@class="date"][contains(text(), "Carte")]'), r'le ([^:]+)', default=None)(self.doc)
         if deferred_date:
             tr.date = parse_french_date(deferred_date).date()
         # rdate > date doesn't make any sense but it seems that lcl website can do shitty things sometimes
         if tr.date >= tr.rdate:
             yield tr
         else:
             self.logger.error('skipping transaction with rdate > date')
开发者ID:P4ncake,项目名称:weboob,代码行数:11,代码来源:pages.py


示例13: get_contact

    def get_contact(self):
        profile_a = self.document.find("a", href=re.compile(r"profil_read.php\?.*"))
        _id = re.search(r"\?(.*)", profile_a["href"]).group(1)

        # not available in the 'boosted' version
        contact = Contact(_id, _id, Contact.STATUS_OFFLINE)
        contact.url = self.url
        contact.profile = {}

        thumbnail_url = "http://photos.onvasortir.com/%s/photos/%s_resize.png" % (self.browser.city, _id)
        if self.document.find("img", attrs={"src": thumbnail_url}):
            photo_url = thumbnail_url.replace("_resize", "")
            contact.set_photo("main", thumbnail_url=thumbnail_url, url=photo_url, hidden=False)

        location_a = self.document.find("a", href=re.compile(r"vue_profil_carte\.php\?"))
        if location_a:
            lat = float(re.search(r"Lat=([\d.]+)", location_a["href"]).group(1))
            self._set_profile(contact, "latitude", lat)
            lng = float(re.search(r"Lng=([\d.]+)", location_a["href"]).group(1))
            self._set_profile(contact, "longitude", lng)

        div = self.document.find("div", attrs={"class": "PADtitreBlanc_txt"}, text=re.compile("Personal Info"))
        td = div.findParent("tr").findNextSibling("tr").td
        infos_text = td.getText(separator="\n").strip()
        it = iter(infos_text.split("\n"))
        infos = dict(zip(it, it))
        if infos["Sex :"] == "Man":
            self._set_profile(contact, "sex", "M")
        elif infos["Sex :"] == "Woman":
            self._set_profile(contact, "sex", "F")
        if infos["Birthday :"] != "Unknown":
            self._set_profile(
                contact, "birthday", parse_french_date(re.search(r"(\d+ \w+ \d+)", infos["Birthday :"]).group(1))
            )
        self._try_attr(contact, infos, "First Name :", "first_name")
        self._try_attr(contact, infos, "Status :", "marriage")
        self._try_attr(contact, infos, "Area :", "area")

        div = self.document.find("div", attrs={"class": "PADtitreBlanc_txt"}, text=re.compile("A few words"))
        td = div.findParent("tr").findNextSibling("tr").td
        summary = td.getText(separator="\n").strip()
        if summary == "Unknown":
            contact.summary = u""
        else:
            contact.summary = summary

        div = self.document.find("div", style=re.compile("dashed"))
        if div:
            # TODO handle html, links and smileys
            contact.status_msg = div.getText()
        else:
            contact.status_msg = u""

        return contact
开发者ID:pombredanne,项目名称:weboob,代码行数:54,代码来源:pages.py


示例14: get_profile

    def get_profile(self):
        profile = Person()

        content = self.get_content()

        profile.name = content['prenom'] + ' ' + content['nom']
        profile.address = content['adresse'] + ' ' + content['codePostal'] + ' ' + content['ville']
        profile.country = content['pays']
        profile.birth_date = parse_french_date(content['dateNaissance']).date()

        return profile
开发者ID:laurentb,项目名称:weboob,代码行数:11,代码来源:pages.py


示例15: get_contact

    def get_contact(self):
        profile_a = self.document.find('a', href=re.compile(r'profil_read.php\?.*'))
        _id = re.search(r'\?(.*)', profile_a['href']).group(1)

        # not available in the 'boosted' version
        contact = Contact(_id, _id, Contact.STATUS_OFFLINE)
        contact.url = self.url
        contact.profile = {}

        thumbnail_url = 'http://photos.onvasortir.com/%s/photos/%s_resize.png' % (self.browser.city, _id)
        if self.document.find('img', attrs={'src': thumbnail_url}):
            photo_url = thumbnail_url.replace('_resize', '')
            contact.set_photo('main', thumbnail_url=thumbnail_url, url=photo_url, hidden=False)

        location_a = self.document.find('a', href=re.compile(r'vue_profil_carte\.php\?'))
        if location_a:
            lat = float(re.search(r'Lat=([\d.]+)', location_a['href']).group(1))
            self._set_profile(contact, 'latitude', lat)
            lng = float(re.search(r'Lng=([\d.]+)', location_a['href']).group(1))
            self._set_profile(contact, 'longitude', lng)

        div = self.document.find('div', attrs={'class': 'PADtitreBlanc_txt'}, text=re.compile('Personal Info'))
        td = div.findParent('tr').findNextSibling('tr').td
        infos_text = td.getText(separator='\n').strip()
        it = iter(infos_text.split('\n'))
        infos = dict(zip(it, it))
        if infos['Sex :'] == 'Man':
            self._set_profile(contact, 'sex', 'M')
        elif infos['Sex :'] == 'Woman':
            self._set_profile(contact, 'sex', 'F')
        if infos['Birthday :'] != 'Unknown':
            self._set_profile(contact, 'birthday', parse_french_date(re.search(r'(\d+ \w+ \d+)', infos['Birthday :']).group(1)))
        self._try_attr(contact, infos, 'First Name :', 'first_name')
        self._try_attr(contact, infos, 'Status :', 'marriage')
        self._try_attr(contact, infos, 'Area :', 'area')

        div = self.document.find('div', attrs={'class': 'PADtitreBlanc_txt'}, text=re.compile('A few words'))
        td = div.findParent('tr').findNextSibling('tr').td
        summary = td.getText(separator='\n').strip()
        if summary == 'Unknown':
            contact.summary = u''
        else:
            contact.summary = summary

        div = self.document.find('div', style=re.compile('dashed'))
        if div:
            # TODO handle html, links and smileys
            contact.status_msg = div.getText()
        else:
            contact.status_msg = u''

        return contact
开发者ID:Konubinix,项目名称:weboob,代码行数:52,代码来源:pages.py


示例16: iter_history

    def iter_history(self):
        header, lines = self.doc[0], self.doc[1:][::-1]
        assert header == ['Date', "Libellé de l'opération ", ' Débit', 'Credit'], "wrong columns"

        for line in lines:
            tr = Transaction()
            tr.raw = line[1]

            assert not (line[2] and line[3]), "cannot have both debit and credit"
            amount = float(line[3] or 0) - abs(float(line[2] or 0))
            tr.amount = Decimal(str(amount))
            tr.date = parse_french_date(line[0])
            yield tr
开发者ID:P4ncake,项目名称:weboob,代码行数:13,代码来源:pages.py


示例17: iter_history

    def iter_history(self, coming):
        for op in self.get('data.listerMouvements.listeMouvements') or []:
            #We have not date for this statut so we just skit it
            if op.get('statut') == u'En cours':
                continue

            tr = Transaction.from_dict({
                'type': Transaction.TYPE_BANK,
                '_state': op.get('statut'),
                'amount': op.get('montantNet'),
                })

            if op.get('statut') == 'Sans suite':
                continue

            tr.parse(date=parse_french_date(op.get('dateSaisie')),
                     vdate = parse_french_date(op.get('dateEffet')) if op.get('dateEffet') else None,
                     raw='%s %s' % (op.get('libelleMouvement'), op.get('canalSaisie') or ''))
            tr._op = op

            if (op.get('statut') == u'Traité') ^ coming:
                yield tr
开发者ID:P4ncake,项目名称:weboob,代码行数:22,代码来源:pages.py


示例18: parse_date

    def parse_date(self, b):
        content = parse_b(b)
        a_date = content[1:content.index('-')]

        for fr, en in date_util.DATE_TRANSLATE_FR:
            a_date[1] = fr.sub(en, a_date[1])

        if (datetime.now().month > datetime.strptime(a_date[1], "%B").month):
            a_date.append(u'%i' % (datetime.now().year + 1))
        else:
            a_date.append(u'%i' % (datetime.now().year))

        return date_util.parse_french_date(" ".join(a_date))
开发者ID:pombredanne,项目名称:weboob,代码行数:13,代码来源:pages.py


示例19: get_profile

 def get_profile(self):
     d = {el[0]: el[1] for el in self.doc}
     profile = Person()
     profile.name = '%s %s' % (d['Nom'], d['Prénom'])
     profile.birth_date = parse_french_date(d['Date de naissance']).date()
     profile.address = '%s %s %s' % (d['Adresse de correspondance'], d['Code postal résidence fiscale'], d['Ville adresse de correspondance'])
     profile.country = d['Pays adresse de correspondance']
     profile.email = d['Adresse e-mail']
     profile.phone = d.get('Téléphone portable')
     profile.job_activity_area = d.get('Secteur d\'activité')
     profile.job = d.get('Situation professionnelle')
     profile.company_name = d.get('Employeur')
     profile.family_situation = d.get('Situation familiale')
     return profile
开发者ID:laurentb,项目名称:weboob,代码行数:14,代码来源:accounts_list.py


示例20: get_history

    def get_history(self, date_guesser, state=None):
        seen = set()
        lines = self.document.xpath('(//table[@class="ca-table"])[2]/tr')
        debit_date = None
        for i, line in enumerate(lines):
            is_balance = line.xpath('./td/@class="cel-texte cel-neg"')

            # It is possible to have three or four columns.
            cols = [self.parser.tocleanstring(td) for td in line.xpath('./td')]
            date = cols[0]
            label = cols[1]
            amount = cols[-1]

            t = Transaction()
            t.set_amount(amount)
            t.label = t.raw = label

            if is_balance:
                m = re.search('(\d+ [^ ]+ \d+)', label)
                if not m:
                    raise BrokenPageError('Unable to read card balance in history: %r' % label)
                if state is None:
                    debit_date = parse_french_date(m.group(1))
                else:
                    debit_date = state

                # Skip the first line because it is balance
                if i == 0:
                    continue

                t.date = t.rdate = debit_date

                # Consider the second one as a positive amount to reset balance to 0.
                t.amount = -t.amount
                state = t.date
            else:
                day, month = map(int, date.split('/', 1))
                t.rdate = date_guesser.guess_date(day, month)
                t.date = debit_date

            t.type = t.TYPE_CARD
            try:
                t.id = t.unique_id(seen)
            except UnicodeEncodeError:
                self.logger.debug(t)
                self.logger.debug(t.label)
                raise

            yield state, t
开发者ID:dasimon,项目名称:weboob,代码行数:49,代码来源:pages.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python json.dumps函数代码示例发布时间:2022-05-26
下一篇:
Python compat.urljoin函数代码示例发布时间: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