fixes for Python 3: fix telneturl

This commit is contained in:
Petr Dlouhý 2019-09-15 19:49:18 +01:00 committed by Chris Mayo
parent 736d2a786d
commit a2e67af7b4
2 changed files with 6 additions and 6 deletions

View file

@ -64,13 +64,13 @@ class TelnetUrl (urlbase.UrlBase):
self.url_connection.set_debuglevel(1)
self.url_connection.open(self.host, self.port)
if self.user:
self.url_connection.read_until("login: ", 10)
self.url_connection.write(encode(self.user)+"\n")
self.url_connection.read_until(b"login: ", 10)
self.url_connection.write(encode(self.user)+b"\n")
if self.password:
self.url_connection.read_until("Password: ", 10)
self.url_connection.write(encode(self.password)+"\n")
self.url_connection.read_until(b"Password: ", 10)
self.url_connection.write(encode(self.password)+b"\n")
# XXX how to tell if we are logged in??
self.url_connection.write("exit\n")
self.url_connection.write(b"exit\n")
def can_get_content (self):
"""

View file

@ -77,7 +77,7 @@ def start_server (host, port, stop_event):
try:
client = telnetlib.Telnet(timeout=TIMEOUT)
client.open(host, port)
client.write("exit\n")
client.write(b"exit\n")
break
except:
time.sleep(0.5)