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


Python Telnet.read_some方法代码示例

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


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

示例1: testLegalRset

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testLegalRset(self):
     """The RSET command takes no arguments."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('RSET')
     self.assertEqual(client.read_some(), '250 Ok\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:10,代码来源:sequential.py

示例2: testMailFromParse

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testMailFromParse(self):
     """The MAIL command will extract the email address from the FROM:."""
 
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('MAIL FROM:<[email protected]>')
     self.assertEqual(client.read_some(), '250 Ok\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:10,代码来源:sequential.py

示例3: testIllegalHelo

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testIllegalHelo(self):
     """HELO takes a single argument."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('HELO')
     self.assertEqual(client.read_some(), '501 Syntax: HELO hostname\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:10,代码来源:sequential.py

示例4: testIllegalRset

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testIllegalRset(self):
     """The RSET command fails if any argument is passed."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('RSET now')
     self.assertEqual(client.read_some(), '501 Syntax: RSET\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:10,代码来源:sequential.py

示例5: testIllegalNoop

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testIllegalNoop(self):
     """The NOOP command fails if any argument is passed."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('NOOP something else here')
     self.assertEqual(client.read_some(), '501 Syntax: NOOP\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:10,代码来源:sequential.py

示例6: testLegalHelo

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testLegalHelo(self):
     """The server responds to a valid HELO command."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('HELO localhost')
     self.assertEqual(client.read_some(), '250 test Hello 127.0.0.1\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:10,代码来源:sequential.py

示例7: testDataWithoutRcpt

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testDataWithoutRcpt(self):
     """The DATA command must be preceded by the RCPT TO: command."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('DATA')
     self.assertEqual(client.read_some(), '503 Error: need RCPT command\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:10,代码来源:sequential.py

示例8: testRcptWithoutMail

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testRcptWithoutMail(self):
     """The RCPT command must be preceded by the MAIL command."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('RCPT TO:<[email protected]>')
     self.assertEqual(client.read_some(), '503 Error: need MAIL command\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:10,代码来源:sequential.py

示例9: testUnknownCommand

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testUnknownCommand(self):
     """Unknown commands are ignored and the client informed."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('EHLO')
     self.assertEqual(client.read_some(), 
                      '502 Error: command "EHLO" not implemented\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:11,代码来源:sequential.py

示例10: testMailInvalidFrom

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testMailInvalidFrom(self):
     """The MAIL command requires FROM: to contain an email address."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('MAIL FROM:')
     self.assertEqual(client.read_some(),
                      '501 Syntax: MAIL FROM:<address>\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:11,代码来源:sequential.py

示例11: testMailNoFrom

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testMailNoFrom(self):
     """The MAIL command requires FROM: to follow it."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('MAIL')
     self.assertEqual(client.read_some(),
                      '501 Syntax: MAIL FROM:<address>\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:11,代码来源:sequential.py

示例12: testMultipleHelo

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testMultipleHelo(self):
     """Only a single HELO command is allowed per connection."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('HELO localhost')
     self.assertEqual(client.read_some(), '250 test Hello 127.0.0.1\r\n')
     client.write('HELO localhost')
     self.assertEqual(client.read_some(), '503 Duplicate HELO/EHLO\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:12,代码来源:sequential.py

示例13: testRcptEmptyTo

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testRcptEmptyTo(self):
     """The RCPT command cannot have an empty TO:."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('MAIL FROM:<[email protected]>')
     self.assertEqual(client.read_some(), '250 Ok\r\n')
     client.write('RCPT TO:')
     self.assertEqual(client.read_some(), '501 Syntax: RCPT TO: <address>\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:12,代码来源:sequential.py

示例14: testRcptWithoutTo

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testRcptWithoutTo(self):
     """The RCPT command must contain TO:<address> as the argument."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('MAIL FROM:<[email protected]>')
     self.assertEqual(client.read_some(), '250 Ok\r\n')
     client.write('RCPT')
     self.assertEqual(client.read_some(), '501 Syntax: RCPT TO: <address>\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:12,代码来源:sequential.py

示例15: testDuplicateMailCommand

# 需要导入模块: from telnetlib import Telnet [as 别名]
# 或者: from telnetlib.Telnet import read_some [as 别名]
 def testDuplicateMailCommand(self):
     """Nested MAIL commands are not allowed."""
     
     client = Telnet('localhost', 1025)
     client.read_some()
     client.write('MAIL FROM:<[email protected]>')
     self.assertEqual(client.read_some(), '250 Ok\r\n')
     client.write('MAIL FROM:<[email protected]>')
     self.assertEqual(client.read_some(), '503 Error: nested MAIL command\r\n')
     client.close()
开发者ID:femto113,项目名称:node-smtpevent,代码行数:12,代码来源:sequential.py


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