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=""" <!doctype html>
<title>my webserver</title> 4×0=04×1=4
4×2=8
4×3=12
4×4=16
4×5=20
4×6=24
4×7=28
4×8=32
4×9=36
4×10=40
"""
class myhandler(BaseHTTPRequestHandler): def do_GET(self): print("request recived")
self.send_response(200)
self.send_header('content-type','text/html; charset=utf-8')
self.end_headers()
#to send the responce
self.wfile.write(Content.encode())
#to create server address
server_address=('',80)
#to listen at the specified port httpd = HTTPServer(server_address,myhandler) print("MY WEBSERVER IS RUNNING...") httpd.serve_forever()
Thus, a webserver is designed to display multiplication table and is hosted in the URL http://surya.student.saveetha.in/