-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathgettrialbalance.py
More file actions
31 lines (21 loc) · 779 Bytes
/
Copy pathgettrialbalance.py
File metadata and controls
31 lines (21 loc) · 779 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""The Python implementation of the gRPC Godbledger client."""
from __future__ import print_function
import random
import logging
import grpc
import transaction_pb2
import transaction_pb2_grpc
def ledger_get_tb(stub, date):
tb = stub.GetTB(transaction_pb2.TBRequest(date=date))
for tbline in tb.lines:
print("{}: {} {}".format(tbline.accountname, tbline.amountStr, tbline.currency))
# for tag in tbline.tags:
# print(" {}".format(tag))
def run():
with grpc.insecure_channel('localhost:50051') as channel:
stub = transaction_pb2_grpc.TransactorStub(channel)
print("-------------- GetTB --------------")
ledger_get_tb(stub, "30/06/2019")
if __name__ == '__main__':
logging.basicConfig()
run()