from twisted.web.soap import Proxy from twisted.internet import reactor def printResult(value): print repr(value) reactor.stop() def printError(error): print 'Error', error reactor.stop() proxy = Proxy('http://localhost:8443/SOAP') proxy.callRemote('listdir', 'User').addCallbacks(printResult, printError) reactor.run()
print "Usage: %s <URL> <OPTIONS> \n" % (sys.argv[0]) print "Options:" print " -a <add_options> \t add photos" print " -f <file_json> \t specified the JSON file" print " -d <path> \t specified the images directory" print "\n" print " -q <file> \t send query file" print " -g <file> \t generate the image index" print "\n" exit(-1) url = sys.argv[1] option = sys.argv[2] path = None proxy = Proxy(url) if (option == "-a"): suboption = sys.argv[3] path = sys.argv[4] if (suboption == "-f"): f = open(path, 'r') json = f.read() f.close() proxy.callRemote('add_photo', json).addCallbacks(callback, errback) reactor.run() elif (suboption == "-d"):