Re: Command Line and JSON-RPC

Figures: Sirius
Quote from: dwdollar on April 06, 2010, 7:07:05 AM UTC

Here is code for a simple Python API. Each method connects to the server, sends a request, gets a response, then returns a Python dictionary equivalent of the JSON. It uses standard Python modules. No error checking is done and only three functions from rpc.cpp are implemented. If there’s interest I can write more.

Well, you could just install python-json-rpc (http://json-rpc.org/wiki/python-json-rpc) and do:

from jsonrpc import ServiceProxy
s = ServiceProxy("http://127.0.0.1:8332")
s.getinfo()

Returns a python dict. It’s that easy 😉