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
# set up socket and connection (socket library) while True: sock, addr = servSock.accept() sock.send("""HTTP/1.1 200 OK Content-Type: text/html <html><body>Hello World</body></html> """); sock.close()