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)
|
||||
|
||||
if path == "/":
|
||||
msg = self.return_get_components(path, query, query_components)
|
||||
msg = self.get_components(path, query, query_components)
|
||||
elif path == "/ying":
|
||||
msg = self.return_ying()
|
||||
msg = self.get_ying()
|
||||
elif path == "/yang":
|
||||
msg = self.return_yang()
|
||||
msg = self.get_yang()
|
||||
elif path == "/squares":
|
||||
msg = self.return_squares(query_components)
|
||||
msg = self.get_squares(query_components)
|
||||
else:
|
||||
msg = "Error 404"
|
||||
self.wfile.write(msg.encode('utf-8'))
|
||||
|
||||
def return_squares(self, query_components):
|
||||
def get_squares(self, query_components):
|
||||
if len(query_components) != 2:
|
||||
msg = "Invalid number of Query Components! Two components needed."
|
||||
else:
|
||||
@ -47,15 +47,15 @@ class SimpleHandler(server.BaseHTTPRequestHandler):
|
||||
return msg
|
||||
|
||||
|
||||
def return_ying(self):
|
||||
def get_ying(self):
|
||||
msg = "<a href='/yang'>Ying</a>"
|
||||
return msg
|
||||
|
||||
def return_yang(self):
|
||||
def get_yang(self):
|
||||
msg = "<a href='/ying'>Yang</a>"
|
||||
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)}"
|
||||
return msg
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user