#!/usr/bin/env python3 # # Usage: python3 server.py PORT import http.server import socketserver import sys class CustomHandler(http.server.SimpleHTTPRequestHandler): def do_GET(self): super().do_GET() def do_POST(self): self.send_response(http.HTTPStatus.OK) self.end_headers() socketserver.TCPServer.allow_reuse_address = True TCP_PORT = int(sys.argv[1]) with socketserver.TCPServer(("", TCP_PORT), CustomHandler) as httpd: print(f"Serving HTTP on port {TCP_PORT} ...") httpd.serve_forever()