import http.server | |
PORT = 7860 | |
class MyHandler(http.server.BaseHTTPRequestHandler): | |
def do_GET(self): | |
self.send_response(200) | |
self.send_header("Content-type", "text/html") | |
self.end_headers() | |
self.wfile.write(b"The manager is running.") | |
server = None | |
try: | |
server = http.server.HTTPServer(("0.0.0.0", PORT), MyHandler) | |
print("Started http server") | |
server.serve_forever() | |
except KeyboardInterrupt: | |
print("^C received, shutting down server") | |
if server is not None: | |
server.socket.close() | |