Merge branch 'master' of https://git.efi.th-nuernberg.de/gitea/heimbsle69869/webeng
This commit is contained in:
commit
4cbf4fd861
16
http-server
16
http-server
@ -15,18 +15,18 @@ class SimpleHandler(server.BaseHTTPRequestHandler):
|
|||||||
query_components = parse.parse_qsl(query)
|
query_components = parse.parse_qsl(query)
|
||||||
|
|
||||||
if path == "/":
|
if path == "/":
|
||||||
msg = self.return_get_components(path, query, query_components)
|
msg = self.get_components(path, query, query_components)
|
||||||
elif path == "/ying":
|
elif path == "/ying":
|
||||||
msg = self.return_ying()
|
msg = self.get_ying()
|
||||||
elif path == "/yang":
|
elif path == "/yang":
|
||||||
msg = self.return_yang()
|
msg = self.get_yang()
|
||||||
elif path == "/squares":
|
elif path == "/squares":
|
||||||
msg = self.return_squares(query_components)
|
msg = self.get_squares(query_components)
|
||||||
else:
|
else:
|
||||||
msg = "Error 404"
|
msg = "Error 404"
|
||||||
self.wfile.write(msg.encode('utf-8'))
|
self.wfile.write(msg.encode('utf-8'))
|
||||||
|
|
||||||
def return_squares(self, query_components):
|
def get_squares(self, query_components):
|
||||||
if len(query_components) != 2:
|
if len(query_components) != 2:
|
||||||
msg = "Invalid number of Query Components! Two components needed."
|
msg = "Invalid number of Query Components! Two components needed."
|
||||||
else:
|
else:
|
||||||
@ -47,15 +47,15 @@ class SimpleHandler(server.BaseHTTPRequestHandler):
|
|||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
||||||
def return_ying(self):
|
def get_ying(self):
|
||||||
msg = "<a href='/yang'>Ying</a>"
|
msg = "<a href='/yang'>Ying</a>"
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def return_yang(self):
|
def get_yang(self):
|
||||||
msg = "<a href='/ying'>Yang</a>"
|
msg = "<a href='/ying'>Yang</a>"
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
def return_get_components(self, path, query, query_components):
|
def get_components(self, path, query, query_components):
|
||||||
msg = f"Path: {path}\nQuery: {query}\nComponents: {str(query_components)}"
|
msg = f"Path: {path}\nQuery: {query}\nComponents: {str(query_components)}"
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user