#!/usr/bin/env python3 import http.server import argparse class DNSUpdateHandler(http.server.BaseHTTPRequestHandler): def do_GET(self): self.send_response(200) self.send_header('Content-type', 'text/plain') self.end_headers() self.wfile.write(b'DNS Update Service is running.\n') def run(server_class=http.server.HTTPServer, handler_class=DNSUpdateHandler, address='127.0.0.1', port=8080): server_address = (address, port) httpd = server_class(server_address, handler_class) print(f'Starting DNS Update Service on {address}:{port}...') httpd.serve_forever() if __name__ == "__main__": parser = argparse.ArgumentParser(description='Run the DNS Update Service.') parser.add_argument('--port', type=int, default=8080, help='Port to run the server on') parser.add_argument('--address', type=str, default='127.0.0.1', help='IP address to listen on (not used in this simple example)') args = parser.parse_args() try: run(address=args.address, port=args.port) except KeyboardInterrupt: print("\nShutting down DNS Update Service.")