From the other posts on stack overflow this should be working
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connec
Your code is almost right, but you need to send 2 \r\n
sequences to satisfy the HTTP protocol.
A valid GET request will look like this (note 2 lines):
GET / HTTP/1.1
So your code should be:
s.sendall('GET / HTTP/1.1\r\n\r\n')
Further to that, there are additional headers required for valid HTTP 1.1 requests, such as Host:
. You need to add them to your request, something like this:
s.sendall('''GET / HTTP/1.1
Host: cnn.com
''')