From c7bfdc356618fd1ccbe0f87fd5009e944cd12e50 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 22 Mar 2019 15:25:33 +0000 Subject: python-rpc: add console.py It allows one to connect to a running daemon or wallet, and use its RPC API from python. Usage: python -i console.py It will detect whether it's talking to a daemon or wallet and initialize itself accordingly. --- utils/python-rpc/framework/daemon.py | 8 ++++++++ utils/python-rpc/framework/wallet.py | 8 ++++++++ 2 files changed, 16 insertions(+) (limited to 'utils/python-rpc/framework') diff --git a/utils/python-rpc/framework/daemon.py b/utils/python-rpc/framework/daemon.py index 11d5f5845..83c8eea67 100644 --- a/utils/python-rpc/framework/daemon.py +++ b/utils/python-rpc/framework/daemon.py @@ -196,3 +196,11 @@ class Daemon(object): 'id': '0' } return self.rpc.send_json_rpc_request(flush_txpool) + + def get_version(self): + get_version = { + 'method': 'get_version', + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(get_version) diff --git a/utils/python-rpc/framework/wallet.py b/utils/python-rpc/framework/wallet.py index e9f13667b..ea683b8c5 100644 --- a/utils/python-rpc/framework/wallet.py +++ b/utils/python-rpc/framework/wallet.py @@ -590,3 +590,11 @@ class Wallet(object): 'id': '0' } return self.rpc.send_json_rpc_request(verify) + + def get_version(self): + get_version = { + 'method': 'get_version', + 'jsonrpc': '2.0', + 'id': '0' + } + return self.rpc.send_json_rpc_request(get_version) -- cgit v1.2.3