import socket


def web_server(host, port):
    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(f'Serving HTTP on port {port}')
    while True:
        client_connection, client_address = listen_socket.accept()
        request_data = client_connection.recv(1024)
        print(request_data.decode('utf-8'))
        http_response = b"HTTP/1.1 200 OK"
        client_connection.sendall(http_response)
        client_connection.close()


if __name__ == '__main__':
    HOST, PORT = '', 8000
    web_server(HOST, PORT)
