I need to send an HTTP response like the one below using python. How can this be accomplished?
HTTP/1.1 200 OK
CodePudding user response:
# 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()