You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

yindundyang.py 1.0KB

4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import http.server
  2. class EigenerHandler(http.server.BaseHTTPRequestHandler):
  3. def do_GET(self):
  4. self.send_response(200)
  5. self.end_headers()
  6. if self.path == "/ying":
  7. msg = """
  8. <html>
  9. <head>
  10. <title>Titel der Seite </title>
  11. </head>
  12. <body>
  13. <a href="/yang">yang</a>
  14. <h1>ying</h1>
  15. </body>
  16. </html>
  17. """
  18. else:
  19. msg = """
  20. <html>
  21. <head>
  22. <title> Titel der Seite </title>
  23. </head>
  24. <body>
  25. <a href="/ying">ying</a>
  26. <h1> yang</h1>
  27. </body>
  28. </html>
  29. """
  30. self.wfile.write(msg.encode('utf-8'))
  31. port = 12345
  32. handler = EigenerHandler
  33. address = ('', port)
  34. server = http.server.HTTPServer(address, handler)
  35. server.serve_forever()