|
|
|
|
|
|
|
|
|
|
|
import http.server |
|
|
|
|
|
import urllib.parse |
|
|
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
|
parsed = urllib.parse.urlparse(self.path) |
|
|
|
|
|
path = parsed.path |
|
|
|
|
|
query = parsed.query |
|
|
|
|
|
query_components = urllib.parse.parse_qsl(query) |
|
|
|
|
|
for |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for k, v in query_components: |
|
|
|
|
|
msg1 = msg1+ ' ' + k + ': ' + v + '\r\n' |
|
|
|
|
|
|
|
|
|
|
|
a = "5" |
|
|
|
|
|
|
|
|
|
|
|
msg = """ |
|
|
|
|
|
<html lang="en"> |
|
|
|
|
|
<style> |
|
|
|
|
|
table, th, td { |
|
|
|
|
|
border: 1px solid black; |
|
|
|
|
|
} |
|
|
|
|
|
</style> |
|
|
|
|
|
<head> |
|
|
|
|
|
<meta charset="UTF-8"> |
|
|
|
|
|
<title>Quadratzahlen</title> |
|
|
|
|
|
</head> |
|
|
|
|
|
<body> |
|
|
|
|
|
<table style> |
|
|
|
|
|
<tr> |
|
|
|
|
|
<td>{}</td> |
|
|
|
|
|
<td>b</td> |
|
|
|
|
|
|
|
|
|
|
|
</body> |
|
|
|
|
|
</html> |
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
self.wfile.write(msg1.encode('utf-8')) |
|
|
|
|
|
self.wfile.write(msg.encode('utf-8')) |
|
|
|
|
|
|
|
|
|
|
|
port = 12345 |
|
|
|
|
|
address = ('', port) |
|
|
|
|
|
|
|
|
|
|
|
handler = EigenerHandler |
|
|
|
|
|
server = http.server.HTTPServer(address, handler) |
|
|
|
|
|
server.serve_forever() |