[Python-checkins] CVS: python/dist/src/Doc/lib libtelnetlib.tex,1.2.4.1,1.2.4.2
Fred L. Drake
fdrake@weyr.cnri.reston.va.us
Wed, 15 Mar 2000 10:25:49 -0500 (EST)
Update of /projects/cvsroot/python/dist/src/Doc/lib
In directory weyr:/home/fdrake/projects/python/Doc-152p2/lib
Modified Files:
Tag: release152p1-patches
libtelnetlib.tex
Log Message:
Changes from Peter Funk <pf@artcom-gmbh.de> (mostly added an example
use).
Index: libtelnetlib.tex
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Doc/lib/libtelnetlib.tex,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -C2 -r1.2.4.1 -r1.2.4.2
*** libtelnetlib.tex 1999/10/28 19:43:35 1.2.4.1
--- libtelnetlib.tex 2000/03/15 15:25:46 1.2.4.2
***************
*** 2,11 ****
Telnet client}
- % LaTeX'ized from the comments in the module by Skip Montanaro
- % <skip@mojam.com>.
-
\declaremodule{standard}{telnetlib}
\modulesynopsis{Telnet client class.}
!
The \module{telnetlib} module provides a \class{Telnet} class that
--- 2,8 ----
Telnet client}
\declaremodule{standard}{telnetlib}
\modulesynopsis{Telnet client class.}
! \sectionauthor{Skip Montanaro}{skip@mojam.com}
The \module{telnetlib} module provides a \class{Telnet} class that
***************
*** 150,151 ****
--- 147,177 ----
results are undeterministic, and may depend on the I/O timing.
\end{methoddesc}
+
+
+ \subsection{Telnet Example \label{telnet-example}}
+ \sectionauthor{Peter Funk}{pf@artcom-gmbh.de}
+
+ A simple example illustrating typical use:
+
+ \begin{verbatim}
+ import getpass
+ import sys
+ import telnetlib
+
+ HOST = "localhost"
+ user = raw_input("Enter your remote account: ")
+ password = getpass.getpass()
+
+ tn = telnetlib.Telnet(HOST)
+
+ tn.read_until("login: ")
+ tn.write(user + "\n")
+ if password:
+ tn.read_until("Password: ")
+ tn.write(password + "\n")
+
+ tn.write("ls\n")
+ tn.write("exit\n")
+
+ print tn.read_all()
+ \end{verbatim}