本文整理匯總了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)