import sys sys.path.insert(0, '/home/ilia/twisted-jsonrpc') from adytum.twisted.web.jsonrpc import Proxy from twisted.internet import reactor def printValue(value): print repr(value) global cnt print cnt cnt = cnt + 1 if cnt == reactorStopCnt: reactor.stop() def printError(error): print 'error', error reactor.stop() banks = ['pc', 'cibc-nurey', 'cibc-ilia'] reactorStopCnt = len(banks) cnt = 0 for bankId in banks: proxy = Proxy('http://localhost:8080/Finance/Bank/JSONFactory', 'TwistedJsonRpcClient_'+bankId) proxy.callRemote('accounts', {'bank_id': bankId, 'card_number': 'XXX', 'password': 'XXX', 'cache_path': '/home/ilia/byob/pages/cache'}).addCallbacks(printValue, printError) reactor.run()