|
|
@@ -0,0 +1,41 @@ |
|
|
|
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() |
|
|
|
print(self.path) |
|
|
|
if self.path=="/ying": |
|
|
|
msg = """ |
|
|
|
<html lang="en"> |
|
|
|
<head> |
|
|
|
<meta charset="UTF-8"> |
|
|
|
<title>Hier ist "Ying"</title> |
|
|
|
</head> |
|
|
|
<body> |
|
|
|
<a href="/yang"> Wo ist "Yang"? </a> |
|
|
|
</body> |
|
|
|
</html> |
|
|
|
""" |
|
|
|
else: |
|
|
|
msg = """ |
|
|
|
<html lang="en"> |
|
|
|
<head> |
|
|
|
<meta charset="UTF-8"> |
|
|
|
<title>Hier ist "Yang"</title> |
|
|
|
</head> |
|
|
|
<body> |
|
|
|
<a href="/ying"> Wo ist "Ying"? </a> |
|
|
|
</body> |
|
|
|
</html> |
|
|
|
""" |
|
|
|
self.wfile.write(msg.encode('utf-8')) |
|
|
|
|
|
|
|
port = 12345 |
|
|
|
address = ('', port) |
|
|
|
|
|
|
|
handler = EigenerHandler |
|
|
|
server = http.server.HTTPServer(address, handler) |
|
|
|
server.serve_forever() |