To develop a simple webserver to serve html pages and display the configuration details of laptop.
HTML content creation.
Design of webserver workflow.
Implementation using Python code.
Serving the HTML pages.
Testing the webserver.
content = """
<!DOCTYPE html>
<html>
<head>
<title>Device Specifications</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
background-color:cornflowerblue;
}
table {
width: 60%;
border-collapse: collapse;
margin: 20px auto;
background: #fff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
th, td {
text-align: left;
padding: 12px;
border: 1px solid #ddd;
}
th {
background-color:crimson;
color: white;
}
tr:nth-child(even) {
background-color: #f9f9f9;
}
tr:hover {
background-color: #f1f1f1;
}
caption {
font-size: 20px;
font-weight: bold;
padding: 10px;
text-align: center;
}
</style>
</head>
<body>
<table>
<caption>Device Specifications</caption>
<tr>
<th>Specification</th>
<th>Details</th>
</tr>
<tr>
<td>Device Name</td>
<td>Gokul</td>
</tr>
<tr>
<td>Processor</td>
<td>13th Gen Intel(R) Core(TM) i5-1335U 1.30GHz</td>
</tr>
<tr>
<td>Installed RAM</td>
<td>16.0 GB (15.7 GB usable)</td>
</tr>
<tr>
<td>Device ID</td>
<td>15EEA3B2-7EF5-4DEC-903D-577382C3C005</td>
</tr>
<tr>
<td>Product ID</td>
<td>00342-42708-98285-AAOEM</td>
</tr>
<tr>
<td>System Type</td>
<td>64-bit operating system, x64-based processor</td>
</tr>
<tr>
<td>Pen and Touch</td>
<td>No pen or touch input is available for this display</td>
</tr>
</table>
</body>
</html>
"""
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.

