def jsonrpc_client_call(url, method, *args, **kwargs):
 _urllib = kwargs.pop('_urllib', urllib)
 if (args and kwargs):
  raise ValueError('Pass *args or **kwargs but not both to jsonrpc_client_call')
 req = {'jsonrpc': '2.0', 'method': method, 'params': (args or kwargs), 'id': 1}
 res = json.loads(_urllib.urlopen(url, json.dumps(req)).read())
 if ('result' in res):
  return res['result']
 elif ('error' in res):
  er = res['error']
  raise JsonRpcError(er['code'], er['message'], er['data'])
 else:
  msg = ("JSON-RPC response must contain 'result' or 'error': %s" % res)
  raise ValueError(msg)

def jsonrpc_client_call ( url , method , * args , ** kwargs ) : _urllib = kwargs . pop ( '_urllib' , urllib ) if ( args and kwargs ) : raise ValueError ( 'Pass *args or **kwargs but not both to jsonrpc_client_call' ) req = { 'jsonrpc' : '2.0' , 'method' : method , 'params' : ( args or kwargs ) , 'id' : 1 } res = json . loads ( _urllib . urlopen ( url , json . dumps ( req ) ) . read ( ) ) if ( 'result' in res ) : return res [ 'result' ] elif ( 'error' in res ) : er = res [ 'error' ] raise JsonRpcError ( er [ 'code' ] , er [ 'message' ] , er [ 'data' ] ) else : msg = ( "JSON-RPC response must contain 'result' or 'error': %s" % res ) raise ValueError ( msg )
execute a json-rpc call on the given url .