Browse Source

Prak1 Nachbearbeitung

master
Tobias Hohwieler 1 year ago
parent
commit
f779e96df6
2 changed files with 32 additions and 13 deletions
  1. 32
    12
      Yingyang/YingYang.py
  2. 0
    1
      client.py

+ 32
- 12
Yingyang/YingYang.py View File

@@ -1,23 +1,43 @@
import http.server


def page(path):
print(path)
match path:
case "/ying.html":
return """
<html>
<head>
<title> YingYang </title>
</head>
<body>
<div> <b>Ying</b> </div>
<div> <a href="yang.html">The second word of power...</a> </div>
</body>
</html>
"""

case "/yang.html":
return """
<html>
<head>
<title> YingYang </title>
</head>
<body>
<div> <b>Yang</b> </div>
<div> <a href="ying.html">The first word of power...</a> </div>
</body>
</html>
"""


class EigenerHandler(http.server.BaseHTTPRequestHandler):

def do_GET(self):
self.send_response(200)
self.send_header('Content-tyoe', 'text-html')
self.send_header('Content-type', 'text-html')
self.end_headers()

msg = """
<html>
<head>
<title> YingYang </title>
</head>
<body>
<b>Ying</b>
</body>
</html>
"""
msg = page(self.path)
self.wfile.write(msg.encode('utf-8'))



+ 0
- 1
client.py View File

@@ -12,7 +12,6 @@ port = 12345
s.connect((host, port))

while True:

msg = input('Wort eingeben: ')
if msg != 'STOP':
s.send(msg.encode('utf-8'))

Loading…
Cancel
Save