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 <port>

It will detect whether it's talking to a daemon or wallet and
initialize itself accordingly.
This commit is contained in:
moneromooo-monero 2019-03-22 15:25:33 +00:00
parent 22b644f47e
commit c7bfdc3566
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
4 changed files with 66 additions and 1 deletions

View file

@ -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)

View file

@ -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)