All pastes #500260 Raw Edit

Miscellany

public text v1 · immutable
·published 2007-05-21 14:50 UTC
rendered paste body
#!/usr/bin/python

from twisted.web.soap import Proxy
from twisted.internet import reactor

def printValue(value):
   #print repr(value)
   pass

def printError(error):
    print 'error', error
    reactor.stop()

def doit(rien=0):
   rien=None
   counter=255
   while counter:
#     print repr(value)
      proxy.callRemote('add', 2.3, 3.2).addCallbacks(printValue, printError)
      proxy.callRemote('sub', 2.3, 3.2).addCallbacks(printValue, printError)
      proxy.callRemote('mul', 2.3, 3.2).addCallbacks(printValue, printError)
      proxy.callRemote('pow', 3, 3).addCallbacks(printValue, printError)
      counter-=1
      if not counter%100 :
         print counter
   else:
      reactor.stop()


proxy = Proxy('http://localhost:7080/calc/')

proxy.callRemote('add', 2.3, 3.2).addCallbacks(doit, printError)

reactor.run()