title: how to send http response message code:400 in python
body: <p>I have written a web server in python and I want to send <strong>HTTP response message codes:400</strong> instead of the response "Website Coming Soon!" on any client-request, please tell how can I do this.</p>
  
  <p><strong>The Server Code is:</strong></p>
  
  <pre><code>import socket
  import re
  HOST = "localhost"
  PORT = 13555
  
  listen_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  listen_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
  listen_socket.bind((HOST, PORT))
  listen_socket.listen(1)
  print ("Serving HTTP on port %s ..." % PORT)
  
  while True:
      client_connection, client_address = listen_socket.accept()
      request = client_connection.recv(2048)
      response = "Website Coming Soon!"   #this response should be http response message code:400
      http_response = "HTTP/1.1 200 OK\n"+"Content-Type: text/html\n"+"\n"+"&lt;html&gt;&lt;body&gt;"+response+"&lt;/body&gt;&lt;/html&gt;\n"
      client_connection.sendall(http_response)
      client_connection.close()
  </code></pre>