本文整理汇总了Python中twisted.conch.ssh.connection.EXTENDED_DATA_STDERR属性的典型用法代码示例。如果您正苦于以下问题:Python connection.EXTENDED_DATA_STDERR属性的具体用法?Python connection.EXTENDED_DATA_STDERR怎么用?Python connection.EXTENDED_DATA_STDERR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类twisted.conch.ssh.connection
的用法示例。
在下文中一共展示了connection.EXTENDED_DATA_STDERR属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_lookupSubsystem_data
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def test_lookupSubsystem_data(self):
"""
After having looked up a subsystem, data should be passed along to the
client. Additionally, subsystems were passed the entire request packet
as data, instead of just the additional data.
We check for the additional tidle to verify that the data passed
through the client.
"""
#self.session.dataReceived('1')
# subsystems didn't get extended data
#self.session.extReceived(connection.EXTENDED_DATA_STDERR, '2')
self.session.requestReceived(b'subsystem',
common.NS(b'TestSubsystem') + b'data')
self.assertEqual(self.session.conn.data[self.session],
[b'\x00\x00\x00\x0dTestSubsystemdata~'])
self.session.dataReceived(b'more data')
self.assertEqual(self.session.conn.data[self.session][-1],
b'more data~')
示例2: test_lookupSubsystem_data
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def test_lookupSubsystem_data(self):
"""
After having looked up a subsystem, data should be passed along to the
client. Additionally, subsystems were passed the entire request packet
as data, instead of just the additional data.
We check for the additional tidle to verify that the data passed
through the client.
"""
#self.session.dataReceived('1')
# subsystems didn't get extended data
#self.session.extReceived(connection.EXTENDED_DATA_STDERR, '2')
self.session.requestReceived('subsystem',
common.NS('TestSubsystem') + 'data')
self.assertEquals(self.session.conn.data[self.session],
['\x00\x00\x00\x0dTestSubsystemdata~'])
self.session.dataReceived('more data')
self.assertEquals(self.session.conn.data[self.session][-1],
'more data~')
示例3: extReceived
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def extReceived(self, dataType, data):
if dataType == connection.EXTENDED_DATA_STDERR:
self.receivedExt.append(data)
else:
log.msg("Unrecognized extended data: %r" % (dataType,))
示例4: test_client_extReceived
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def test_client_extReceived(self):
"""
SSHSession.extReceived() passed data of type EXTENDED_DATA_STDERR along
to the client. If the data comes before there is a client, or if the
data is not of type EXTENDED_DATA_STDERR, it is discared.
"""
self.session.extReceived(connection.EXTENDED_DATA_STDERR, b'1')
self.session.extReceived(255, b'2') # 255 is arbitrary
self.session.client = StubClient()
self.session.extReceived(connection.EXTENDED_DATA_STDERR, b'3')
self.assertEqual(self.session.client.transport.err, b'3')
示例5: test_client_extReceivedWithoutWriteErr
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def test_client_extReceivedWithoutWriteErr(self):
"""
SSHSession.extReceived() should handle the case where the transport
on the client doesn't have a writeErr method.
"""
client = self.session.client = StubClient()
client.transport = StubTransport() # doesn't have writeErr
# should not raise an error
self.session.extReceived(connection.EXTENDED_DATA_STDERR, b'ignored')
示例6: extReceived
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def extReceived(self, t, data):
if t==connection.EXTENDED_DATA_STDERR:
log.msg('got %s stderr data' % len(data))
sys.stderr.write(data)
sys.stderr.flush()
示例7: extReceived
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def extReceived(self, dataType, data):
if dataType == connection.EXTENDED_DATA_STDERR:
if self.client and hasattr(self.client.transport, 'writeErr'):
self.client.transport.writeErr(data)
else:
log.msg('weird extended data: %s'%dataType)
示例8: errReceived
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def errReceived(self, err):
self.session.writeExtended(connection.EXTENDED_DATA_STDERR, err)
示例9: extReceived
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def extReceived(self, ext_type, data):
from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR
if ext_type == EXTENDED_DATA_STDERR:
self.dataReceived(data)
示例10: extReceived
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def extReceived(self, dataType, data):
unittest.assertEquals(dataType, connection.EXTENDED_DATA_STDERR)
self.testBuf += data
示例11: test_client_extReceived
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def test_client_extReceived(self):
"""
SSHSession.extReceived() passed data of type EXTENDED_DATA_STDERR along
to the client. If the data comes before there is a client, or if the
data is not of type EXTENDED_DATA_STDERR, it is discared.
"""
self.session.extReceived(connection.EXTENDED_DATA_STDERR, '1')
self.session.extReceived(255, '2') # 255 is arbitrary
self.session.client = StubClient()
self.session.extReceived(connection.EXTENDED_DATA_STDERR, '3')
self.assertEquals(self.session.client.transport.err, '3')
示例12: test_client_extReceivedWithoutWriteErr
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def test_client_extReceivedWithoutWriteErr(self):
"""
SSHSession.extReceived() should handle the case where the transport
on the client doesn't have a writeErr method.
"""
client = self.session.client = StubClient()
client.transport = StubTransport() # doesn't have writeErr
# should not raise an error
self.session.extReceived(connection.EXTENDED_DATA_STDERR, 'ignored')
示例13: extReceived
# 需要导入模块: from twisted.conch.ssh import connection [as 别名]
# 或者: from twisted.conch.ssh.connection import EXTENDED_DATA_STDERR [as 别名]
def extReceived(self, t, data):
if t==connection.EXTENDED_DATA_STDERR:
log.msg('got %s stderr data' % len(data))
sys.stderr.write(data)