-
Notifications
You must be signed in to change notification settings - Fork 2
/
sendtransaction.py
37 lines (29 loc) · 1014 Bytes
/
sendtransaction.py
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
32
33
34
35
36
37
"""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 run():
with grpc.insecure_channel('localhost:50051') as channel:
stub = transaction_pb2_grpc.TransactorStub(channel)
print("-------------- Sending Transaction --------------")
response = stub.AddTransaction(transaction_pb2.TransactionRequest(
date="2019-06-30",
description="Sales",
lines=[
transaction_pb2.LineItem(
accountname="Income",
description="Some Specifics",
amount=-1000),
transaction_pb2.LineItem(
accountname="Cash",
description="Some Specifics",
amount=1000)
]
))
print(response)
if __name__ == '__main__':
logging.basicConfig()
run()