In [23]:
import telnetlib
In [36]:
with telnetlib.Telnet('now.httpbin.org', '80') as conn:
conn.write(b'GET / HTTP/1.1\r\nHOST: now.httpbin.org\r\n\r\n')
resp = conn.read_until(b']}').decode('utf-8')
print(resp)