new poject 2
This commit is contained in:
commit
b215207109
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
50
serv.py
Normal file
50
serv.py
Normal file
@ -0,0 +1,50 @@
|
||||
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
|
||||
msg = ''
|
||||
|
||||
if path == '/ying':
|
||||
msg = """
|
||||
<html>
|
||||
<head>
|
||||
<title> Ying und Yang </title>
|
||||
</head>
|
||||
<body>
|
||||
ying
|
||||
<a href="yang">click here</a>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
if path == '/yang':
|
||||
msg = """
|
||||
<html>
|
||||
<head>
|
||||
<title> Ying und Yang </title>
|
||||
</head>
|
||||
<body>
|
||||
yang
|
||||
<a href="ying">click here</a>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
self.wfile.write(msg.encode('utf-8'))
|
||||
|
||||
|
||||
|
||||
port = 12345
|
||||
handler = MyHandler
|
||||
address = ('', port)
|
||||
|
||||
server = http.server.HTTPServer(address, handler)
|
||||
server.serve_forever()
|
||||
|
12
yang.html
Normal file
12
yang.html
Normal file
@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>yang</title>
|
||||
</head>
|
||||
<body>
|
||||
yang
|
||||
<a href="ying">Click for ying</a>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user