|
@@ -21,6 +21,24 @@ class HttpGetHandler(BaseHTTPRequestHandler):
|
|
|
http_text = """<html><head><meta charset="utf-8">
|
|
|
<title>Информация</title></head>
|
|
|
<body>Педус Даниил Витальевич 701(3)<br><br>"""
|
|
|
+
|
|
|
+ self.wfile.write(http_text.encode())
|
|
|
+ if self.path.endswith("/Status"):
|
|
|
+ self.send_response(200)
|
|
|
+ self.send_header("Content-type", "text/html")
|
|
|
+ self.end_headers()
|
|
|
+ data = datetime.now().strftime("%Y-%m-%d %I:%M:%S %p")
|
|
|
+ address = self.client_address[0]
|
|
|
+ address = re.sub("([.][0-9]{1,3})", ".x", address, count = 2)
|
|
|
+ http_text = f"<html><head><meta charset='utf-8'>" \
|
|
|
+ f"<title>Статус</title></head>" \
|
|
|
+ f"<body>Ваш IP:{address}<br>" \
|
|
|
+ f"ФИО: Педус Даниил Витальевич<br>" \
|
|
|
+ f"Дата: {data}<br><br>"
|
|
|
+
|
|
|
+ self.wfile.write(http_text.encode())
|
|
|
+ except IOError:
|
|
|
+ self.send_error(400,f"File not found{self.path}")
|
|
|
|
|
|
def main(server_class=HTTPServer,handler_class=HttpGetHandler):
|
|
|
server_address = ('localhost',8000)
|