本文整理汇总了Python中twisted.internet.protocol.Factory.employees方法的典型用法代码示例。如果您正苦于以下问题:Python Factory.employees方法的具体用法?Python Factory.employees怎么用?Python Factory.employees使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.internet.protocol.Factory
的用法示例。
在下文中一共展示了Factory.employees方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_error
# 需要导入模块: from twisted.internet.protocol import Factory [as 别名]
# 或者: from twisted.internet.protocol.Factory import employees [as 别名]
response['message'] = message['message']
self.associated_client.message(json.dumps(response))
print "Score: "
self.getScore(message['message'])
else:
response['type'] = constants.ERROR
response['message'] = "Client not conencted"
self.message(json.dumps(response))
def handle_error(self):
print "Handling error"
def getScore(self, text):
url = "https://api.sentigem.com/external/get-sentiment"
api_key = "6352f666047a4a30aa8f346d7793d5296Twn2FfkboMSWjt9OYg5PyAJG7v8BK1q"
search_url = [url, '?']
args = {'api-key': api_key, 'text':text}
search_url.append(urlencode(args))
data = json.loads(urlopen(''.join(search_url)).read())
print str(data)
factory = Factory()
factory.protocol = IphoneChat
factory.employees = []
reactor.listenTCP(PORT, factory)
print "Iphone Chat server started " + str(PORT)
reactor.run()