예제 #1
0
    def listMethods(self):
        """Overrides ServiceHandler.listMethods to add methods supplied by plugins."""

        methods = ServiceHandler.listMethods(self)
        for plugin in self.service_plugins.extensions(self.env):
            methods.extend(ServiceHolder(plugin).listMethods())

        return methods
예제 #2
0
# -*- coding: utf-8 -*-
import sys

sys.path.append("../")
from common import *
from jsonrpc import ServiceProxy
from jsonrpc import JSONRPCException
from jsonrpc import ServiceHandler
import jsonrpc

handler = ServiceHandler("")
print "ready"
mm = ModuleManager()
print mm.getModuleInstance("TTS")

print handler.listMethods()
json = jsonrpc.dumps({
    "method": "system.listMethods",
    "params": [''],
    'id': ''
})
print handler.handleRequest(json)
json = jsonrpc.dumps({
    "method": "modules.TTS.text_to_wave",
    "params": ["hello"],
    'id': ''
})
print handler.handleRequest(json)
json = jsonrpc.dumps({
    "method": "modules.Fortune.fortune_ml",
    "params": [u"ആന"],
예제 #3
0
파일: test.py 프로젝트: Stultus2/silpa
# -*- coding: utf-8 -*-
import sys
sys.path.append("../")
from common import *
from jsonrpc import ServiceProxy
from jsonrpc import JSONRPCException
from jsonrpc import ServiceHandler
import jsonrpc
handler=ServiceHandler("")
print "ready"
mm = ModuleManager()
print mm.getModuleInstance("TTS")

print handler.listMethods()
json=jsonrpc.dumps({"method":"system.listMethods",  "params":[''], 'id':''})
print handler.handleRequest(json)
json=jsonrpc.dumps({"method":"modules.TTS.text_to_wave", "params":["hello"], 'id':''})
print handler.handleRequest(json)
json=jsonrpc.dumps({"method":"modules.Fortune.fortune_ml", "params":[u"ആന"], 'id':''})
print handler.handleRequest(json)
json=jsonrpc.dumps({"method":"modules.Hyphenator.hyphenate", "params":[u"ആനയാരാമോന്‍"], 'id':''})
print handler.handleRequest(json)
json=jsonrpc.dumps({"method":"modules.Hyphenator.hyphenate", "params":[u"hithukollaalo"], 'id':''})
print handler.handleRequest(json)
json=jsonrpc.dumps({"method":"modules.LangGuess.guessLanguage", "params":[u"ആന"], 'id':''})
print handler.handleRequest(json)
json=jsonrpc.dumps({"version":"1.1","method":"modules.Fortune.fortune_ml","id":2,"params":[""]})
print handler.handleRequest(json)
json=jsonrpc.dumps({"version":"1.1","method":"modules.Dictionary.getdef","id":2,"params":["word","freedict-eng-hin"]})
print handler.handleRequest(json)
json=jsonrpc.dumps({"version":"1.1","method":"modules.CharDetails.getdetails","id":2,"params":[u"c"]})