feat: complete lab3 network scripts

This commit is contained in:
Артём Садаков 2026-05-07 17:11:10 +03:00
parent 179f019121
commit aa6080c4ad
2 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,6 @@
import requests
response = requests.get("http://127.0.0.1:8080")
print("Статус-код:", response.status_code)
print("Ответ сервера:", response.text)

16
HTTP/local_http_server.py Normal file
View File

@ -0,0 +1,16 @@
from http.server import HTTPServer, BaseHTTPRequestHandler
class SimpleHandler(BaseHTTPRequestHandler):
def do_GET(self):
message = "Hello from local HTTP server"
self.send_response(200)
self.send_header("Content-type", "text/plain; charset=utf-8")
self.end_headers()
self.wfile.write(message.encode("utf-8"))
server = HTTPServer(("127.0.0.1", 8080), SimpleHandler)
print("HTTP сервер запущен: http://127.0.0.1:8080")
server.serve_forever()