瀏覽代碼

Удалить 'server-2.0.py'

gr714_kusev 4 月之前
父節點
當前提交
3c665e351e
共有 1 個文件被更改,包括 0 次插入79 次删除
  1. 0 79
      server-2.0.py

+ 0 - 79
server-2.0.py

@@ -1,79 +0,0 @@
-import http.server
-import socketserver
-import socket
-from datetime import datetime
-
-from ipaddress import ip_address
-import self
-from pip._internal.vcs import git
-
-
-class MyHandler(http.server.SimpleHTTPRequestHandler):
-    def do_GET(self):
-        if self.path == '/':
-            self.send_response(200)
-            self.send_header('Content-type', 'text/html; charset=utf-8')
-            self.end_headers()
-            self.wfile.write(b"""
-                <html>
-                <head><title>Fits Page</title></head>
-                <body>
-                    <h1>Hello</h1>
-                    <p>General page</p>
-                    <button onclick="location.href='/status'">Status</button>
-                    <button onclick="location.href='/img'">img</button>
-                </body>
-                </html>
-            """)
-
-        elif self.path == '/img':
-            self.send_response(200)
-            self.send_header('Content-type', 'text/html; charset=utf-8')
-            self.end_headers()
-            self.wfile.write(b"""
-                <html>
-                <head><title>Image</title></head>
-                <body>
-                    <h1>Stalin Tyan</h1>
-                    <p>Slava Sovetskomu Souzu</p>
-                    <button onclick="location.href='/'">Back</button>
-                    <h2><img src="https://yt3.googleusercontent.com/ytc/AGIKgqODvXcSJJzpm-fzI3o42tAXsdA4AdX0j4EjuiNHlQE=s900-c-k-c0x00ffffff-no-rj"></h2>
-                </body>
-                </html>
-            """)
-
-
-        elif self.path == '/status':
-            ip_address = self.client_address[0]
-            ip_parts = ip_address[0].split('.')
-        if len(ip_parts) == 4:
-            masked_ip = f"{ip_parts[0]}.***.***.{ip_parts[3]}"
-
-        else:
-            masked_ip = "Не найден :("
-            student_name = ("Кухарев Сергей Евгеньевич Группа: 714")
-            current_time = datetime.now().strftime("%d.%m.%Y %I:%M:%S %p")
-
-            response_content = f"""
-                <html>
-                <head><title>Status Page</title></head>
-                <body>
-                    <h1>Статус:</h1>
-                    <p>Ip-адрес: {masked_ip}</p>
-                    <p>Фио: {student_name}</p>
-                    <p>Текущее время: {current_time}</p>
-                    <button onclick="location.href='/'">Back</button>
-                </body>
-                </html>
-            """.encode("utf-8")
-            self.send_response(200)
-            self.send_header('Content-type', 'text/html; charset=utf-8')
-            self.end_headers()
-            self.wfile.write(response_content)
-
-hostname = socket.gethostname()
-port = 8080
-
-with socketserver.TCPServer((hostname, port), MyHandler) as httpd:
-    print(f"Server on {hostname}:{port}")
-    httpd.serve_forever()