mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-11 03:50:44 +01:00
Internet: Use socket directly instead of telnetlib
We don't actually need telnetlib here; and it will be removed in Python 3.11
This commit is contained in:
parent
0ad61f5791
commit
e18332efde
@ -31,7 +31,6 @@
|
||||
|
||||
import time
|
||||
import socket
|
||||
import telnetlib
|
||||
|
||||
import supybot.conf as conf
|
||||
import supybot.utils as utils
|
||||
@ -158,14 +157,14 @@ class Internet(callbacks.Plugin):
|
||||
if not status:
|
||||
status = 'unknown'
|
||||
try:
|
||||
t = telnetlib.Telnet('whois.iana.org', 43)
|
||||
sock = socket.create_connection(('whois.iana.org', 43))
|
||||
except socket.error as e:
|
||||
irc.error(str(e))
|
||||
return
|
||||
t.write(b'registrar ')
|
||||
t.write(registrar.split('(')[0].strip().encode('ascii'))
|
||||
t.write(b'\n')
|
||||
s = t.read_all()
|
||||
sock.sendall(b'registrar ')
|
||||
sock.sendall(registrar.split('(')[0].strip().encode('ascii'))
|
||||
sock.sendall(b'\n')
|
||||
s = sock.recv(100000)
|
||||
url = ''
|
||||
for line in s.splitlines():
|
||||
line = line.decode('ascii').strip()
|
||||
|
Loading…
x
Reference in New Issue
Block a user