[Twisted-Python] telnet client code
Thomas Heller
theller at python.net
Thu May 8 02:10:58 MDT 2003
I have this snippet running in it's own thread, and would like
to port it to twisted, my program is using it anyway.
Any hints how to get started?
Thanks, Thomas
import telnetlib, time, socket
try:
tn = telnetlib.Telnet(host)
except socket.error, detail:
print "reboot failed", host, detail
return
tn.read_until("Username: ")
tn.write("tel\r\n")
tn.read_until("Password: ")
tn.write("tel\r\n")
time.sleep(1)
tn.read_some()
tn.write("reboot\r\n")
time.sleep(1)
More information about the Twisted-Python
mailing list