ghubstan 49404cebc5
Reorganize the python-examples module
- Use requirements.txt to install dependencies to local venv.
- Use setup.py to build/install example packages to local venv.
- Adjust reference-doc-builder to new Python pkg imports.
2022-03-17 12:44:28 -03:00

27 lines
906 B
Python

from builtins import print
import grpc
# from getpass import getpass
import python_examples.bisqapi.grpc_pb2 as bisq_messages
import python_examples.bisqapi.grpc_pb2_grpc as bisq_service
def main():
grpc_channel = grpc.insecure_channel('localhost:9998')
grpc_service_stub = bisq_service.WalletsStub(grpc_channel)
api_password: str = 'xyz' # getpass("Enter API password: ")
try:
response = grpc_service_stub.VerifyBsqSentToAddress.with_call(
bisq_messages.VerifyBsqSentToAddressRequest(
address='Bbcrt1q9elrmtxtzpwt25zq2pmeeu6qk8029w404ad0xn',
amount='10.00'),
metadata=[('password', api_password)])
print('BSQ amount was received at address: ' + str(response[0].is_amount_received))
except grpc.RpcError as rpc_error:
print('gRPC API Exception: %s', rpc_error)
if __name__ == '__main__':
main()