diff --git a/pcl_expect/telnet.py b/pcl_expect/telnet.py index 17fc3867923a50dc49c4e6b12b729506d0ae7f6a..0c128d42089b7b7ccfe98b4f99e3143b4c8b8443 100644 --- a/pcl_expect/telnet.py +++ b/pcl_expect/telnet.py @@ -1,3 +1,6 @@ +"""Connect to a telnet server via the telnetlib.Telnet class. +""" + import telnetlib import pcl_expect @@ -8,6 +11,12 @@ __all__ = [ class Telnet(pcl_expect.Expectable): def __init__(self, host, port): + """Establish a telnet session. + + The host and port argument are passed to telnetlib.Telnet. + + """ + self.telnet = telnetlib.Telnet(host, port) pcl_expect.Expectable.__init__(self, self.telnet.fileno()) @@ -19,9 +28,11 @@ class Telnet(pcl_expect.Expectable): return s, False def send(self, s): + """Send a string to the remote telnet server.""" self.telnet.write(s) def close(self): + """Close the telnet session.""" pcl_expect.Expectable.close(self) self.telnet.close()