123456789101112131415161718192021222324252627282930313233343536373839 |
- import http.server
- import urllib.parse
-
-
- class MyHandler(http.server.BaseHTTPRequestHandler):
-
- def do_GET(self):
- self.send_response(200)
- self.end_headers()
-
- parsed = urllib.parse.urlparse(self.path)
- path = parsed.path
- query = parsed.query
- query_components = urllib.parse.parse_qsl(query)
-
- start = query_components["von="]
- end = query_components["bis="]
-
- msg = """
- <html>
- <head>
- <title>Quadratzahlen</title>
- </head>
- <body>
- {}
- {}
- </body>
- </html>
- """.format(start, end)
-
- self.wfile.write(msg.encode('utf-8'))
-
-
- port = 12345
- handler = MyHandler
- address = ('', port)
-
- server = http.server.HTTPServer(address, handler)
- server.serve_forever()
|