本文整理汇总了Python中twisted.protocols.basic.LineReceiver.sendLine方法的典型用法代码示例。如果您正苦于以下问题:Python LineReceiver.sendLine方法的具体用法?Python LineReceiver.sendLine怎么用?Python LineReceiver.sendLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.protocols.basic.LineReceiver
的用法示例。
在下文中一共展示了LineReceiver.sendLine方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, line):
if self.onXMLReceived:
raise FoneworxException, "onXMLReceived already initialized before sending"
self.onXMLReceived = Deferred()
log.msg("Sending line: %s" % line, logLevel=logging.DEBUG)
LineReceiver.sendLine(self, line)
return self.onXMLReceived
示例2: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, line):
"""
Override sendLine to add a timeout to response.
"""
if not self._current:
self.setTimeout(self.persistentTimeOut)
LineReceiver.sendLine(self, line)
示例3: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, line):
if isinstance(line, str):
if six.PY3:
super(StringLineReceiver, self).sendLine(line.encode())
else:
LineReceiver.sendLine(self, line.encode())
elif isinstance(line, bytes):
if six.PY3:
super(StringLineReceiver, self).sendLine(line)
else:
LineReceiver.sendLine(self, line)
else:
raise RuntimeError("Only str and bytes are allowed.")
示例4: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, line):
self.log.info('SEND: ' + line)
for regex, callback in self.send_line_hooks:
if regex.match(line) is not None:
callback(self, line)
return LineReceiver.sendLine(self, line)
示例5: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, s):
#print('->', s)
LineReceiver.sendLine(self, s)
示例6: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, line):
if self._ping_deferred:
self._ping_deferred.reset(self.ping_interval)
return LineReceiver.sendLine(self, line)
示例7: sendCommand
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendCommand(self, cmd):
print ">", cmd
LineReceiver.sendLine( self, cjson.encode(cmd) )
示例8: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, line):
if isinstance(line, unicode):
line = line.encode('utf-8')
LineReceiver.sendLine(self, line)
示例9: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, line):
log_outgoing(line)
LineReceiver.sendLine(self, line)
示例10: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, line):
# Assure that the string isn't unicode.
return LineReceiver.sendLine(self, str(line))
示例11: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, line):
print "Relay -> iPhone",line
LineReceiver.sendLine(self,line)
示例12: _reallySendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def _reallySendLine(self, line):
if self.debug >= 2: print "REALLY SENDING LINE:", repr(lowQuote(line) + self.delimiter)
return LineReceiver.sendLine(self, lowQuote(line) + self.delimiter)
示例13: send
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def send(self, data):
LineReceiver.sendLine(self, data) # LineReceiver is an old style class.
示例14: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, line):
LineReceiver.sendLine(self, line)
示例15: sendLine
# 需要导入模块: from twisted.protocols.basic import LineReceiver [as 别名]
# 或者: from twisted.protocols.basic.LineReceiver import sendLine [as 别名]
def sendLine(self, data):
"Send data to remote server"
# <data> has to be JSON-encoded before being sent to remote server
twisted_logger.writeLog(self.logPrefix, self.logName, "Sending data to remote server: %s..." % data)
LineReceiver.sendLine(self, json.dumps(data))