12345678910111213141516171819202122232425262728 |
- import http.server
-
-
- class EigenerHandler(http.server.BaseHTTPRequestHandler):
-
- def do_GET(self):
- self.send_response(200)
- self.send_header('Content-type', 'text-html')
- self.end_headers()
- msg = """
- <html>
- <head>
- <title> Yang </title>
- <head>
- <body>
- <b>Yang<b>
- <p>Hello. To the website <a href="http://localhost:12345/">Ying</a>?<br /></p>
- <body>
- <html>
- """
- self.wfile.write(msg.encode())
-
- port = 54321
- Handler = EigenerHandler
- address = ('', port)
-
- server = http.server.HTTPServer(address, Handler)
- server.serve_forever()
|