Честно, искренне, от всего сердца Я НЕ ЛЮБЛЮ PYTHON
Элементарный, простейщий сервер ... тишина ... не работает, ошибки не вижу.
from http.server import BaseHTTPRequestHandler
from http.server import HTTPServer
class ServerWorking(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header('Content-type', 'text/html')
self.end_headers()
self.wfile.write(bytes("<html><head><title>Python Server</title></head>", "utf-8"))
self.wfile.write(bytes("<body><h1>Питон работает</h1>", "utf-8"))
self.wfile.write(bytes("</body></html>", "utf-8"))
server_address = ('', 8080)
server = HTTPServer(server_address, BaseHTTPRequestHandler)
server.serve_forever()
ERROR
server = HTTPServer(server_address, BaseHTTPRequestHandler)
File "/usr/lib64/python3.9/socketserver.py", line 452, in __init__
self.server_bind()
File "/usr/lib64/python3.9/http/server.py", line 138, in server_bind
socketserver.TCPServer.server_bind(self)
File "/usr/lib64/python3.9/socketserver.py", line 466, in server_bind
self.socket.bind(self.server_address)
...
Error response
Error code: 501
Message: Unsupported method ('GET').
Error code explanation: HTTPStatus.NOT_IMPLEMENTED - Server does not support this operation.