Python twisted.protocols.basic.LineOnlyReceiver() Examples
The following are 9
code examples of twisted.protocols.basic.LineOnlyReceiver().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
twisted.protocols.basic
, or try the search function
.
Example #1
Source File: pop3client.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 6 votes |
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.
Example #2
Source File: pop3client.py From learn_python3_spider with MIT License | 6 votes |
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.
Example #3
Source File: test_basic.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
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')
Example #4
Source File: runner.py From flocker with Apache License 2.0 | 5 votes |
def __str__(self): return repr(self) # LineOnlyReceiver is mutable, so can't use pyrsistent
Example #5
Source File: test_basic.py From learn_python3_spider with MIT License | 5 votes |
def test_greaterThanMaximumLineLength(self): """ C{LineOnlyReceiver} disconnects the transport if it receives a line longer than its C{MAX_LENGTH} + len(delimiter). """ proto = LineOnlyTester() transport = proto_helpers.StringTransport() proto.makeConnection(transport) proto.dataReceived(b'x' * (proto.MAX_LENGTH + len(proto.delimiter) + 1) + b'\r\nr') self.assertTrue(transport.disconnecting)
Example #6
Source File: test_basic.py From learn_python3_spider with MIT License | 5 votes |
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')
Example #7
Source File: jsonrpc.py From p2pool-n with GNU General Public License v3.0 | 5 votes |
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)
Example #8
Source File: pop3.py From python-for-android with Apache License 2.0 | 5 votes |
def failResponse(self, message=''): self.sendLine('-ERR ' + str(message)) # def sendLine(self, line): # print 'S:', repr(line) # basic.LineOnlyReceiver.sendLine(self, line)
Example #9
Source File: pop3.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def failResponse(self, message=''): self.sendLine('-ERR ' + str(message)) # def sendLine(self, line): # print 'S:', repr(line) # basic.LineOnlyReceiver.sendLine(self, line)