123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import http.server
-
- class EigenerHandler(http.server.BaseHTTPRequestHandler):
-
- def do_GET(self):
- self.send_response(200)
- self.end_headers()
- if self.path == "/ying":
- msg = """
- <html>
- <head>
- <title>Titel der Seite </title>
- </head>
- <body>
- <a href="/yang">yang</a>
- <h1>ying</h1>
- </body>
- </html>
- """
- else:
- msg = """
- <html>
- <head>
- <title> Titel der Seite </title>
- </head>
- <body>
- <a href="/ying">ying</a>
- <h1> yang</h1>
- </body>
-
- </html>
-
- """
-
- self.wfile.write(msg.encode('utf-8'))
-
-
- port = 12345
- handler = EigenerHandler
- address = ('', port)
- server = http.server.HTTPServer(address, handler)
- server.serve_forever()
|