new poject 2

This commit is contained in:
Tu Quyen Tran Ngoc 2019-10-22 14:50:45 +02:00
commit b215207109
4 changed files with 79 additions and 0 deletions

6
.idea/vcs.xml generated Normal file
View 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
View 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
View 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>

11
ying.html Normal file
View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Ying</title>
</head>
<body>
ying
<a href="yang">Click for yang</a>
</body>
</html>