12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- import http.server
-
-
- def page(path):
- print(path)
- match path:
- case "/ying.html":
- return """
- <html>
- <head>
- <title> YingYang </title>
- </head>
- <body>
- <div> <b>Ying</b> </div>
- <div> <a href="yang.html">The second word of power...</a> </div>
- </body>
- </html>
- """
-
- case "/yang.html":
- return """
- <html>
- <head>
- <title> YingYang </title>
- </head>
- <body>
- <div> <b>Yang</b> </div>
- <div> <a href="ying.html">The first word of power...</a> </div>
- </body>
- </html>
- """
-
-
- class EigenerHandler(http.server.BaseHTTPRequestHandler):
-
- def do_GET(self):
- self.send_response(200)
- self.send_header('Content-type', 'text-html')
- self.end_headers()
- msg = page(self.path)
- self.wfile.write(msg.encode('utf-8'))
-
-
- port = 12345
- handler = EigenerHandler
- address = ('', port)
-
- server = http.server.HTTPServer(address, handler)
- server.serve_forever()
|