with closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as s:
    s.connect(('127.0.0.1', 8080))
s.sendall('GET / HTTP/1.0\r\n\r\n')
How to use a generator to split socket read data on newlines