@@ -0,0 +1,1703 @@
+#!/usr/bin/env python3%0A# -*- coding: utf8 -*-%0A%0Aimport requests%0Aimport json%0Afrom base64 import b64encode%0A%0A%0Aclass BtcContext:%0A    def __init__ (self, rpcserver, rpcport, rpcuser, rpcpassword):%0A        self.rpcserver = rpcserver%0A        self.rpcport = rpcport%0A        self.rpcuser = rpcuser%0A        self.rpcpassword = rpcpassword%0A        self.rpcrequestid = 1%0A%0A    def incrpcrequestid(self):%0A        rpcrequestid = self.rpcrequestid%0A        self.rpcrequestid += 1%0A        return rpcrequestid%0A%0A%0Adef builduri(ctx):%0A    return 'http://%7B%7D:%7B%7D/'.format(ctx.rpcserver, ctx.rpcport)%0A%0A%0Adef buildauthzheader(ctx):%0A    return 'Basic %7B%7D'.format(b64encode(%0A        ctx.rpcuser + b':' + ctx.rpcpassword%0A        ).decode('utf8'))%0A%0A%0Adef btcrequest(ctx, method, params):%0A    r = requests.post(builduri(ctx),%0A        headers = %7B%0A            'Host' : ctx.rpcserver,%0A            'Connection' : 'close',%0A            'Content-Type' : 'application/json',%0A            'Authorization' : buildauthzheader(ctx)%0A            %7D,%0A        json=%7B%0A            'jsonrpc' : '1.0',%0A            'method' : method,%0A            'params' : params,%0A            'id' : ctx.incrpcrequestid()%0A            %7D%0A        )%0A    if r.status_code != 200:%0A        return None%0A    return r.json()%0A%0A%0Adef getinfo(ctx):%0A    return btcrequest(ctx, 'getinfo', %5B%5D)%0A%0A%0Adef getnetworkinfo(ctx):%0A    return btcrequest(ctx, 'getnetworkinfo', %5B%5D)%0A%0A%0Adef getwalletinfo(ctx):%0A    return btcrequest(ctx, 'getwalletinfo', %5B%5D)%0A%0A%0Aif __name__ == '__main__':%0A    ctx = BtcContext(%0A        rpcserver='127.0.0.1', %0A        rpcport = 18332,%0A        rpcuser = b'u1',%0A        rpcpassword = b'p1'%0A    )%0A    print(getinfo(ctx))%0A    print(getnetworkinfo(ctx))%0A    print(getwalletinfo(ctx))%0A%0A

add bitcoincli.py: