I need to send an HTTP response like the one below using python. How can this be accomplished?
HTTP/1.1 200 OK
Advertisement
Answer
JavaScript
x
10
10
1
# set up socket and connection (socket library)
2
while True:
3
sock, addr = servSock.accept()
4
sock.send("""HTTP/1.1 200 OK
5
Content-Type: text/html
6
7
<html><body>Hello World</body></html>
8
""");
9
sock.close()
10