/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer class MyServer(BaseHTTPRequestHandler): def do_GET(self): self.send_response(200, 'OK') self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write( "hello" ) @staticmethod def serve_forever(port): HTTPServer(('', port), MyServer).serve_forever() if __name__ == "__main__": MyServer.serve_forever(8080)