所以我正在尝试制作一个 Growtopia 服务器模拟器,但实际上我遇到了这个令人困惑的错误。我找不到任何关于...这是我的代码import cgi #not used yetimport http.serverimport logging #not used yetimport socketserverclass ServerHandler(http.server.BaseHTTPRequestHandler): def do_POST(self): self.send_response(200) self.end_headers() self.wfile.write("server|127.0.0.1\nport|17091\ntype|1\n#maint|Mainetrance message (Not used for now) -- Growtopia Noobs\n\nbeta_server|127.0.0.1\nbeta_port|17091\n\nbeta_type|1\nmeta|localhost\nRTENDMARKERBS1001") def do_GET(self): self.send_response(200) self.end_headers() self.wfile.write("server|127.0.0.1\nport|17091\ntype|1\n#maint|Mainetrance message (Not used for now) -- Growtopia Noobs\n\nbeta_server|127.0.0.1\nbeta_port|17091\n\nbeta_type|1\nmeta|localhost\nRTENDMARKERBS1001") def log_message(self, format, *args): returnPORT = 80HOST = ""Handler = http.server.SimpleHTTPRequestHandler,ServerHandlerOUT_HOST = HOSThttpd = socketserver.TCPServer((HOST, PORT), Handler)print("Server Port : ", PORT)if OUT_HOST == "" or " " or "\n": print("Server Hostname : ", "localhost")else: print("Server Hostname : ", HOST)httpd.serve_forever()
1 回答
喵喵时光机
TA贡献1846条经验 获得超7个赞
我通过添加Handler = http.server.SimpleHTTPRequestHandler
到 ServerHandler 类解决了这个问题。
添加回答
举报
0/150
提交
取消