Skip to content
Snippets Groups Projects
Commit 4e4f22be authored by Per Cederqvist's avatar Per Cederqvist
Browse files

Mention telnetlib.py.

parent 714b4970
No related branches found
No related tags found
No related merge requests found
...@@ -195,3 +195,31 @@ time, this seems to be a fairly mature and complete expect-like ...@@ -195,3 +195,31 @@ time, this seems to be a fairly mature and complete expect-like
module. module.
This is the only module that seems to be actively maintained. This is the only module that seems to be actively maintained.
telnetlib.py
------------
The telnetlib.py module supplied with Python contains an expect
method.
Sample usage:
tn = Telnet()
tn.open(host, port)
ix, match, txt = tn.expect(["login:"])
tn.write("ceder\n")
ix, match, txt = tn.expect(["password:", "ceder@.*>"])
if ix == 0:
tn.write("secret\n")
ix, match, txt = tn.expect(["ceder@.*>"])
Why this isn't good enough:
- only supports telnet
- there is no way to wait for input from more than one process at a
time.
- no support for expect_after and expect_before
- cumbersome syntax
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment