Python twisted.internet.interfaces.ITransport() Examples
The following are 26
code examples of twisted.internet.interfaces.ITransport().
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.internet.interfaces
, or try the search function
.
Example #1
Source File: protocol.py From learn_python3_spider with MIT License | 5 votes |
def getHost(self): # FIXME: https://twistedmatrix.com/trac/ticket/7820 # According to ITransport, this should return an IAddress! return 'file'
Example #2
Source File: protocol.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def getHost(self): # XXX: According to ITransport, this should return an IAddress! return 'file'
Example #3
Source File: protocol.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def getPeer(self): # XXX: According to ITransport, this should return an IAddress! return 'file', 'file'
Example #4
Source File: iosim.py From python-for-android with Apache License 2.0 | 5 votes |
def getHost(self): # XXX: According to ITransport, this should return an IAddress! return 'file'
Example #5
Source File: iosim.py From python-for-android with Apache License 2.0 | 5 votes |
def getPeer(self): # XXX: According to ITransport, this should return an IAddress! return 'file', 'file'
Example #6
Source File: protocol.py From python-for-android with Apache License 2.0 | 5 votes |
def getHost(self): # XXX: According to ITransport, this should return an IAddress! return 'file'
Example #7
Source File: protocol.py From python-for-android with Apache License 2.0 | 5 votes |
def getPeer(self): # XXX: According to ITransport, this should return an IAddress! return 'file', 'file'
Example #8
Source File: test_connection.py From magic-wormhole with MIT License | 5 votes |
def make_con(role, use_relay=False): clock = Clock() eq = EventualQueue(clock) connector = mock.Mock() alsoProvides(connector, IDilationConnector) n = mock.Mock() # pretends to be a Noise object n.write_message = mock.Mock(side_effect=[b"handshake"]) c = DilatedConnectionProtocol(eq, role, "desc", connector, n, b"outbound_prologue\n", b"inbound_prologue\n") if use_relay: c.use_relay(b"relay_handshake\n") t = mock.Mock() alsoProvides(t, ITransport) return c, n, connector, t, eq
Example #9
Source File: test_framer.py From magic-wormhole with MIT License | 5 votes |
def make_framer(): t = mock.Mock() alsoProvides(t, ITransport) f = _Framer(t, b"outbound_prologue\n", b"inbound_prologue\n") return f, t
Example #10
Source File: channel.py From learn_python3_spider with MIT License | 5 votes |
def getHost(self): """ See: L{ITransport.getHost} @return: An address describing this side of the connection. @rtype: L{SSHTransportAddress}. """ return self.conn.transport.getHost()
Example #11
Source File: channel.py From learn_python3_spider with MIT License | 5 votes |
def getPeer(self): """ See: L{ITransport.getPeer} @return: The remote address of this connection. @rtype: L{SSHTransportAddress}. """ return self.conn.transport.getPeer()
Example #12
Source File: test_channel.py From learn_python3_spider with MIT License | 5 votes |
def test_interface(self): """ L{SSHChannel} instances provide L{interfaces.ITransport}. """ self.assertTrue(verifyObject(interfaces.ITransport, self.channel))
Example #13
Source File: loopback.py From learn_python3_spider with MIT License | 5 votes |
def write(self, data): if not isinstance(data, bytes): raise TypeError("Can only write bytes to ITransport") self.q.put(data)
Example #14
Source File: http.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def _respondToBadRequestAndDisconnect(self): """ This is a quick and dirty way of responding to bad requests. As described by HTTP standard we should be patient and accept the whole request from the client before sending a polite bad request response, even in the case when clients send tons of data. @param transport: Transport handling connection to the client. @type transport: L{interfaces.ITransport} """ self.transport.write(b"HTTP/1.1 400 Bad Request\r\n\r\n") self.loseConnection()
Example #15
Source File: protocol.py From learn_python3_spider with MIT License | 5 votes |
def getPeer(self): # FIXME: https://twistedmatrix.com/trac/ticket/7820 # According to ITransport, this should return an IAddress! return 'file', 'file'
Example #16
Source File: test_endpoints.py From learn_python3_spider with MIT License | 5 votes |
def test_verifyTransport(self): """ L{_ProcessEndpointTransport}s provide L{ITransport}. """ verifyObject(ITransport, self.endpointTransport)
Example #17
Source File: _posixstdio.py From learn_python3_spider with MIT License | 5 votes |
def __init__(self, proto, stdin=0, stdout=1, reactor=None): if reactor is None: from twisted.internet import reactor self.protocol = proto self._writer = process.ProcessWriter(reactor, self, 'write', stdout) self._reader = process.ProcessReader(reactor, self, 'read', stdin) self._reader.startReading() self.protocol.makeConnection(self) # ITransport # XXX Actually, see #3597.
Example #18
Source File: http.py From learn_python3_spider with MIT License | 5 votes |
def _respondToBadRequestAndDisconnect(self): """ This is a quick and dirty way of responding to bad requests. As described by HTTP standard we should be patient and accept the whole request from the client before sending a polite bad request response, even in the case when clients send tons of data. @param transport: Transport handling connection to the client. @type transport: L{interfaces.ITransport} """ self.transport.write(b"HTTP/1.1 400 Bad Request\r\n\r\n") self.loseConnection()
Example #19
Source File: channel.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def getHost(self): """ See: L{ITransport.getHost} @return: An address describing this side of the connection. @rtype: L{SSHTransportAddress}. """ return self.conn.transport.getHost()
Example #20
Source File: channel.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def getPeer(self): """ See: L{ITransport.getPeer} @return: The remote address of this connection. @rtype: L{SSHTransportAddress}. """ return self.conn.transport.getPeer()
Example #21
Source File: test_channel.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_interface(self): """ L{SSHChannel} instances provide L{interfaces.ITransport}. """ self.assertTrue(verifyObject(interfaces.ITransport, self.channel))
Example #22
Source File: loopback.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def write(self, data): if not isinstance(data, bytes): raise TypeError("Can only write bytes to ITransport") self.q.put(data)
Example #23
Source File: protocol.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def getHost(self): # FIXME: https://twistedmatrix.com/trac/ticket/7820 # According to ITransport, this should return an IAddress! return 'file'
Example #24
Source File: protocol.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def getPeer(self): # FIXME: https://twistedmatrix.com/trac/ticket/7820 # According to ITransport, this should return an IAddress! return 'file', 'file'
Example #25
Source File: test_endpoints.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def test_verifyTransport(self): """ L{_ProcessEndpointTransport}s provide L{ITransport}. """ verifyObject(ITransport, self.endpointTransport)
Example #26
Source File: _posixstdio.py From Safejumper-for-Desktop with GNU General Public License v2.0 | 5 votes |
def __init__(self, proto, stdin=0, stdout=1, reactor=None): if reactor is None: from twisted.internet import reactor self.protocol = proto self._writer = process.ProcessWriter(reactor, self, 'write', stdout) self._reader = process.ProcessReader(reactor, self, 'read', stdin) self._reader.startReading() self.protocol.makeConnection(self) # ITransport # XXX Actually, see #3597.