本文整理汇总了Python中Yowsup.connectionmanager.YowsupConnectionManager.getMethodInterface方法的典型用法代码示例。如果您正苦于以下问题:Python YowsupConnectionManager.getMethodInterface方法的具体用法?Python YowsupConnectionManager.getMethodInterface怎么用?Python YowsupConnectionManager.getMethodInterface使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Yowsup.connectionmanager.YowsupConnectionManager
的用法示例。
在下文中一共展示了YowsupConnectionManager.getMethodInterface方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LibInterfaceHandler
# 需要导入模块: from Yowsup.connectionmanager import YowsupConnectionManager [as 别名]
# 或者: from Yowsup.connectionmanager.YowsupConnectionManager import getMethodInterface [as 别名]
class LibInterfaceHandler(InterfaceHandlerBase):
def __init__(self, username):
self.connectionManager = YowsupConnectionManager()
self.signalInterface = self.connectionManager.getSignalInterface()
self.methodInterface = self.connectionManager.getMethodInterface()
super(LibInterfaceHandler,self).__init__();
self.initSignals()
self.initMethods()
def initSignals(self):
self.signals = self.signalInterface.getSignals()
def initMethods(self):
#get methods
self.methods = self.methodInterface.getMethods()
def connectToSignal(self, signalName, callback):
if not self.isSignal(signalName):
raise InvalidSignalException()
self.signalInterface.registerListener(signalName, callback)
def call(self, methodName, params = ()):
if not self.isMethod(methodName):
raise InvalidMethodException()
return self.methodInterface.call(methodName, params)