Browse Source

test1 neu

master
Kevin Holzschuh 5 years ago
parent
commit
557deb0787
2 changed files with 47 additions and 1 deletions
  1. 27
    0
      HttpHtml/Quadratzahlen.py
  2. 20
    1
      HttpHtml/Server.py

+ 27
- 0
HttpHtml/Quadratzahlen.py View File

@@ -0,0 +1,27 @@
import http.server
import urllib.parse

class newHandler(http.server.BaseHTTPRequestHandler):

def do_GET(self):
self.send_response(200)
self.end_headers()

parseUrl = urllib.parse.urlparse(self.path)
path = parseUrl.path
query = parseUrl.query

#query_components = urllib.parse.parse_qsl(query)

msg = query

self.wfile.write(msg.encode('utf-8'))



PORT = 4096
HANDLER = newHandler
ADDRESS = ('', PORT)

SERVER = http.server.HTTPServer(ADDRESS, HANDLER)
SERVER.serve_forever()

+ 20
- 1
HttpHtml/Server.py View File

@@ -1,7 +1,26 @@
import http.server
import urllib.parse

class newHandler(http.server.BaseHTTPRequestHandler):

def do_GET(self):
self.send_response(200)
self.end_headers()

parseUrl = urllib.parse.urlparse(self.path)
path = parseUrl.path

if path == "/Yang":
msg1 = "<a href='/Ying'>" + path + "</a>"
elif path == "/Ying":
msg1 = "<a href='/Yang'>" + path + "</a>"

self.wfile.write(msg1.encode('utf-8'))



PORT = 4096
HANDLER = http.server.SimpleHTTPRequestHandler
HANDLER = newHandler
ADDRESS = ('', PORT)

SERVER = http.server.HTTPServer(ADDRESS, HANDLER)

Loading…
Cancel
Save