gns3-docker-appliances/basic_server/server.py

17 lines
473 B
Python
Raw Normal View History

2024-09-20 12:41:10 +00:00
from http.server import BaseHTTPRequestHandler, HTTPServer
PORT = 80
print(f"Will listen on port {PORT}")
class handler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type','text/html')
self.end_headers()
message = "Hello, World! Here is simple HTTP response..."
self.wfile.write(bytes(message, "utf8"))
with HTTPServer(('', PORT), handler) as server:
server.serve_forever()