Browse Source

Praktikum 2

master
parent
commit
a2f5c86802
1 changed files with 44 additions and 0 deletions
  1. 44
    0
      aufgabe2/httpserver.py

+ 44
- 0
aufgabe2/httpserver.py View File

@@ -0,0 +1,44 @@
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
adress = ('', port)
server = http.server.HTTPServer(adress, handler)
server.serve_forever()



Loading…
Cancel
Save