|
|
@@ -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) |