当前位置: 首页>>代码示例>>Python>>正文


Python interfaces.ITransport方法代码示例

本文整理汇总了Python中twisted.internet.interfaces.ITransport方法的典型用法代码示例。如果您正苦于以下问题:Python interfaces.ITransport方法的具体用法?Python interfaces.ITransport怎么用?Python interfaces.ITransport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在twisted.internet.interfaces的用法示例。


在下文中一共展示了interfaces.ITransport方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _respondToBadRequestAndDisconnect

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
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() 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:15,代码来源:http.py

示例2: __init__

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
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. 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:15,代码来源:_posixstdio.py

示例3: test_verifyTransport

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
def test_verifyTransport(self):
        """
        L{_ProcessEndpointTransport}s provide L{ITransport}.
        """
        verifyObject(ITransport, self.endpointTransport) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:7,代码来源:test_endpoints.py

示例4: getPeer

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
def getPeer(self):
        # FIXME: https://twistedmatrix.com/trac/ticket/7820
        # According to ITransport, this should return an IAddress!
        return 'file', 'file' 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:6,代码来源:protocol.py

示例5: getHost

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
def getHost(self):
        # FIXME: https://twistedmatrix.com/trac/ticket/7820
        # According to ITransport, this should return an IAddress!
        return 'file' 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:6,代码来源:protocol.py

示例6: write

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
def write(self, data):
        if not isinstance(data, bytes):
            raise TypeError("Can only write bytes to ITransport")
        self.q.put(data) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:6,代码来源:loopback.py

示例7: test_interface

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
def test_interface(self):
        """
        L{SSHChannel} instances provide L{interfaces.ITransport}.
        """
        self.assertTrue(verifyObject(interfaces.ITransport, self.channel)) 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:7,代码来源:test_channel.py

示例8: getPeer

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
def getPeer(self):
        """
        See: L{ITransport.getPeer}

        @return: The remote address of this connection.
        @rtype: L{SSHTransportAddress}.
        """
        return self.conn.transport.getPeer() 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:10,代码来源:channel.py

示例9: getHost

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
def getHost(self):
        """
        See: L{ITransport.getHost}

        @return: An address describing this side of the connection.
        @rtype: L{SSHTransportAddress}.
        """
        return self.conn.transport.getHost() 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:10,代码来源:channel.py

示例10: make_framer

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
def make_framer():
    t = mock.Mock()
    alsoProvides(t, ITransport)
    f = _Framer(t, b"outbound_prologue\n", b"inbound_prologue\n")
    return f, t 
开发者ID:warner,项目名称:magic-wormhole,代码行数:7,代码来源:test_framer.py

示例11: make_con

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
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 
开发者ID:warner,项目名称:magic-wormhole,代码行数:16,代码来源:test_connection.py

示例12: getPeer

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
def getPeer(self):
        # XXX: According to ITransport, this should return an IAddress!
        return 'file', 'file' 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:5,代码来源:protocol.py

示例13: getHost

# 需要导入模块: from twisted.internet import interfaces [as 别名]
# 或者: from twisted.internet.interfaces import ITransport [as 别名]
def getHost(self):
        # XXX: According to ITransport, this should return an IAddress!
        return 'file' 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:5,代码来源:protocol.py


注:本文中的twisted.internet.interfaces.ITransport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。