Skip to content

Siddhu-ui/simplewebserver

 
 

Repository files navigation

EX01 Developing a Simple Webserver

Date:19.10.2024

AIM:

To develop a simple webserver to serve html pages and display the configuration details of laptop.

DESIGN STEPS:

Step 1:

HTML content creation.

Step 2:

Design of webserver workflow.

Step 3:

Implementation using Python code.

Step 4:

Serving the HTML pages.

Step 5:

Testing the webserver.

PROGRAM:

''' content='''

<title>My Laptop Specifications</title> <style> body { font-family: Arial, sans-serif; background-color: #f4f4f4; color: #333; max-width: 600px; margin: 20px auto; padding: 20px; border: 2px solid #ccc; border-radius: 10px; } h1 { color: #0066cc; text-align: center; } ul { list-style-type: none; padding: 0; } li { background: #fff; margin: 10px 0; padding: 10px; border-radius: 5px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.2); } .highlight { font-weight: bold; color: #333; } </style>

Lenovo ThinkPad Specifications

Below are the specifications of my Lenovo ThinkPad laptop:

  • Brand: Lenovo ThinkPad
  • Processor: Intel Core i5 / i7 (Choose based on your model)
  • RAM: 8GB / 16GB DDR4
  • Storage: 256GB / 512GB SSD
  • Graphics: Integrated Intel UHD / Intel Iris Xe
  • Display: 14-inch Full HD (1920x1080)
  • Operating System: Windows 10 / 11 or Linux
  • Battery Life: Up to 12 hours
  • Weight: Approx. 1.5 kg

This Lenovo ThinkPad is known for its robust build quality, excellent keyboard, and reliable performance, making it ideal for work and productivity tasks.

'''

class MyServer(BaseHTTPRequestHandler): def do_GET(self): print("Get request received...") self.send_response(200) self.send_header("content-type", "text/html")
self.end_headers() self.wfile.write(content.encode())

print("This is my webserver") server_address =('',8000) httpd = HTTPServer(server_address,MyServer) httpd.serve_forever()

'''

OUTPUT:

alt text

alt text

RESULT:

The program for implementing simple webserver is executed successfully.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.3%
  • HTML 0.7%