本文整理匯總了Python中weboob.capabilities.bank.Transaction.vdate方法的典型用法代碼示例。如果您正苦於以下問題:Python Transaction.vdate方法的具體用法?Python Transaction.vdate怎麽用?Python Transaction.vdate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類weboob.capabilities.bank.Transaction
的用法示例。
在下文中一共展示了Transaction.vdate方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_history
# 需要導入模塊: from weboob.capabilities.bank import Transaction [as 別名]
# 或者: from weboob.capabilities.bank.Transaction import vdate [as 別名]
def get_history(self, account):
if not account._consultable:
raise NotImplementedError()
offset = 0
next_page = True
while next_page:
r = self.open('/transactionnel/services/applications/operations/get/%(number)s/%(nature)s/00/%(currency)s/%(startDate)s/%(endDate)s/%(offset)s/%(limit)s' %
{'number': account._number,
'nature': account._nature,
'currency': account.currency,
'startDate': '2000-01-01',
'endDate': date.today().strftime('%Y-%m-%d'),
'offset': offset,
'limit': 50
})
next_page = False
offset += 50
for op in r.json()['content']['operations']:
next_page = True
t = Transaction()
t.id = op['id']
t.amount = Decimal(str(op['montant']))
t.date = date.fromtimestamp(op.get('dateDebit', op.get('dateOperation'))/1000)
t.rdate = date.fromtimestamp(op.get('dateOperation', op.get('dateDebit'))/1000)
t.vdate = date.fromtimestamp(op.get('dateValeur', op.get('dateDebit', op.get('dateOperation')))/1000)
if 'categorie' in op:
t.category = op['categorie']
t.label = op['libelle']
t.raw = ' '.join([op['libelle']] + op['details'])
yield t
示例2: get_history
# 需要導入模塊: from weboob.capabilities.bank import Transaction [as 別名]
# 或者: from weboob.capabilities.bank.Transaction import vdate [as 別名]
def get_history(self, account):
if not account._consultable:
raise NotImplementedError()
offset = 0
next_page = True
seen = set()
while next_page:
r = self.api_open(
"/transactionnel/services/applications/operations/get/%(number)s/%(nature)s/00/%(currency)s/%(startDate)s/%(endDate)s/%(offset)s/%(limit)s"
% {
"number": account._number,
"nature": account._nature,
"currency": account.currency,
"startDate": "2000-01-01",
"endDate": date.today().strftime("%Y-%m-%d"),
"offset": offset,
"limit": 50,
}
)
next_page = False
offset += 50
transactions = []
for op in reversed(r.json()["content"]["operations"]):
next_page = True
t = Transaction()
if op["id"] in seen:
raise ParseError("There are several transactions with the same ID, probably an infinite loop")
t.id = op["id"]
seen.add(t.id)
t.amount = Decimal(str(op["montant"]))
t.date = date.fromtimestamp(op.get("dateDebit", op.get("dateOperation")) / 1000)
t.rdate = date.fromtimestamp(op.get("dateOperation", op.get("dateDebit")) / 1000)
t.vdate = date.fromtimestamp(op.get("dateValeur", op.get("dateDebit", op.get("dateOperation"))) / 1000)
if "categorie" in op:
t.category = op["categorie"]
t.label = op["libelle"]
t.raw = " ".join([op["libelle"]] + op["details"])
transactions.append(t)
# Transactions are unsorted
for t in sorted(transactions, key=lambda t: t.rdate, reverse=True):
yield t
示例3: get_history
# 需要導入模塊: from weboob.capabilities.bank import Transaction [as 別名]
# 或者: from weboob.capabilities.bank.Transaction import vdate [as 別名]
def get_history(self, account):
if not account._consultable:
raise NotImplementedError()
if account._univers != self.current_univers:
self.move_to_univers(account._univers)
offset = 0
next_page = True
seen = set()
while next_page:
r = self.api_open('/transactionnel/services/applications/operations/get/%(number)s/%(nature)s/00/%(currency)s/%(startDate)s/%(endDate)s/%(offset)s/%(limit)s' %
{'number': account._number,
'nature': account._nature,
'currency': account.currency,
'startDate': '2000-01-01',
'endDate': date.today().strftime('%Y-%m-%d'),
'offset': offset,
'limit': 50
})
next_page = False
offset += 50
transactions = []
for op in reversed(r.json()['content']['operations']):
next_page = True
t = Transaction()
if op['id'] in seen:
raise ParseError('There are several transactions with the same ID, probably an infinite loop')
t.id = op['id']
seen.add(t.id)
t.amount = Decimal(str(op['montant']))
t.date = date.fromtimestamp(op.get('dateDebit', op.get('dateOperation'))/1000)
t.rdate = date.fromtimestamp(op.get('dateOperation', op.get('dateDebit'))/1000)
t.vdate = date.fromtimestamp(op.get('dateValeur', op.get('dateDebit', op.get('dateOperation')))/1000)
if 'categorie' in op:
t.category = op['categorie']
t.label = op['libelle']
t.raw = ' '.join([op['libelle']] + op['details'])
transactions.append(t)
# Transactions are unsorted
for t in sorted(transactions, key=lambda t: t.rdate, reverse=True):
yield t