To develop a simple webserver to serve html pages.
HTML content creation.
Design of webserver workflow.
Implementation using Python code.
Serving the HTML pages.
Testing the webserver.
from http.server import HTTPServer,BaseHTTPRequestHandler content = """
<title> Image Map </title>Rank | Company | Revenue | FY |
---|---|---|---|
1 | Microsoft | $86.8 | 2014 |
2 | Oracle | $37.1 | 2013 |
3 | SAP | $20.9 | 2013 |
4 | Symantec | $6.8 | 2013 |
5 | VMware | $5.2 | 2013 |
""" class myhandler(BaseHTTPRequestHandler): def do_GET(self): print("request received") self.send_response(200) self.send_header('content-type', 'text/html; charset=utf-8') self.end_headers() self.wfile.write(content.encode()) server_address = ('',8000) httpd = HTTPServer(server_address,myhandler) print("my webserver is running...") httpd.serve_forever()
The program for implementing simple webserver is executed successfully.