To work with Bitcoin RPC from python there is a library Python-BitcoinRPC.

But recently i need to call API from tornado application. Mentioned lib works in synchronous, i.e. blocking mode. For tornado it will be much better to use asynchronous version. Tried to search for existing solution, but can’t find it. So i create my async fork, that use tornado’s AsyncHTTPClient:

Example (print current number of blocks in Bitcoin network):

from bitcoinrpc_async.authproxy import AsyncAuthServiceProxy
from tornado import ioloop, gen

BITCOIN_RPC_URL = "http://user:password@"

def show_block_count():
    service = AsyncAuthServiceProxy(BITCOIN_RPC_URL)
    result = yield service.getblockcount()
    print result

io_loop = ioloop.IOLoop.instance()