Python twisted.protocols.basic 模块,LineOnlyReceiver() 实例源码

我们从Python开源项目中,提取了以下12个代码示例,用于说明如何使用twisted.protocols.basic.LineOnlyReceiver()

项目:zenchmarks    作者:squeaky-pl    | 项目源码 | 文件源码
def lineLengthExceeded(self, buffer):
        """
        Drop the connection when a server response exceeds the maximum line
        length (L{LineOnlyReceiver.MAX_LENGTH}).

        @type buffer: L{bytes}
        @param buffer: A received line which exceeds the maximum line length.
        """
        # XXX - We need to be smarter about this
        if self._waiting is not None:
            waiting, self._waiting = self._waiting, None
            waiting.errback(LineTooLong())
        self.transport.loseConnection()


    # POP3 Client state logic - don't touch this.
项目:netwatch    作者:recourse    | 项目源码 | 文件源码
def sendLine(self, msg):
      basic.LineOnlyReceiver.sendLine(self, msg+'\r')
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def failResponse(self, message=''):
        self.sendLine('-ERR ' + str(message))

#    def sendLine(self, line):
#        print 'S:', repr(line)
#        basic.LineOnlyReceiver.sendLine(self, line)
项目:p2pool-bch    作者:amarian12    | 项目源码 | 文件源码
def __init__(self):
        #basic.LineOnlyReceiver.__init__(self)
        self._matcher = deferral.GenericDeferrer(max_id=2**30, func=lambda id, method, params: self.sendLine(json.dumps({
            'jsonrpc': '2.0',
            'method': method,
            'params': params,
            'id': id,
        })))
        self.other = Proxy(self._matcher)
项目:p2pool-unitus    作者:amarian12    | 项目源码 | 文件源码
def __init__(self):
        #basic.LineOnlyReceiver.__init__(self)
        self._matcher = deferral.GenericDeferrer(max_id=2**30, func=lambda id, method, params: self.sendLine(json.dumps({
            'jsonrpc': '2.0',
            'method': method,
            'params': params,
            'id': id,
        })))
        self.other = Proxy(self._matcher)
项目:p2pool-dgb-sha256    作者:ilsawa    | 项目源码 | 文件源码
def __init__(self):
        #basic.LineOnlyReceiver.__init__(self)
        self._matcher = deferral.GenericDeferrer(max_id=2**30, func=lambda id, method, params: self.sendLine(json.dumps({
            'jsonrpc': '2.0',
            'method': method,
            'params': params,
            'id': id,
        })))
        self.other = Proxy(self._matcher)
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def failResponse(self, message=''):
        self.sendLine('-ERR ' + str(message))

#    def sendLine(self, line):
#        print 'S:', repr(line)
#        basic.LineOnlyReceiver.sendLine(self, line)
项目:p2pool-ltc    作者:ilsawa    | 项目源码 | 文件源码
def __init__(self):
        #basic.LineOnlyReceiver.__init__(self)
        self._matcher = deferral.GenericDeferrer(max_id=2**30, func=lambda id, method, params: self.sendLine(json.dumps({
            'jsonrpc': '2.0',
            'method': method,
            'params': params,
            'id': id,
        })))
        self.other = Proxy(self._matcher)
项目:p2pool-bsty    作者:amarian12    | 项目源码 | 文件源码
def __init__(self):
        #basic.LineOnlyReceiver.__init__(self)
        self._matcher = deferral.GenericDeferrer(max_id=2**30, func=lambda id, method, params: self.sendLine(json.dumps({
            'jsonrpc': '2.0',
            'method': method,
            'params': params,
            'id': id,
        })))
        self.other = Proxy(self._matcher)
项目:p2pool-cann    作者:ilsawa    | 项目源码 | 文件源码
def __init__(self):
        #basic.LineOnlyReceiver.__init__(self)
        self._matcher = deferral.GenericDeferrer(max_id=2**30, func=lambda id, method, params: self.sendLine(json.dumps({
            'jsonrpc': '2.0',
            'method': method,
            'params': params,
            'id': id,
        })))
        self.other = Proxy(self._matcher)
项目:netwatch    作者:project-netwatch    | 项目源码 | 文件源码
def sendLine(self, msg):
      basic.LineOnlyReceiver.sendLine(self, msg+'\r')
项目:zenchmarks    作者:squeaky-pl    | 项目源码 | 文件源码
def test_lineReceivedNotImplemented(self):
        """
        When L{LineOnlyReceiver.lineReceived} is not overridden in a subclass,
        calling it raises C{NotImplementedError}.
        """
        proto = basic.LineOnlyReceiver()
        self.assertRaises(NotImplementedError, proto.lineReceived, 'foo')