Browse Source

new poject 2

master
Tu Quyen Tran Ngoc 5 years ago
parent
commit
bfd3d9c91e
1 changed files with 39 additions and 0 deletions
  1. 39
    0
      quadratzahlenServ.py

+ 39
- 0
quadratzahlenServ.py View File

@@ -0,0 +1,39 @@
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()

Loading…
Cancel
Save