Select Git revision
Per Cederqvist authored
telnet.py 560 B
import telnetlib
import pcl_expect
__all__ = [
"Telnet",
]
class Telnet(pcl_expect.Expectable):
def __init__(self, host, port):
self.telnet = telnetlib.Telnet(host, port)
pcl_expect.Expectable.__init__(self, self.telnet.fileno())
def _read(self):
try:
s = self.telnet.read_eager()
except EOFError:
return "", True
return s, False
def send(self, s):
self.telnet.write(s)
def close(self):
pcl_expect.Expectable.close(self)
self.telnet.close()