import BaseHTTPServer
class WebInterface(BaseHTTPServer.BaseHTTPRequestHandler):
server_version = "httpd/0.0"
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
self.wfile.write("Requested: ")
self.wfile.write(self.path)
def main(server_class=BaseHTTPServer.HTTPServer,
handler_class=WebInterface):
server_address = ('', 8000)
httpd = server_class(server_address, handler_class)
# httpd.serve_forever()
while True:
httpd.handle_request()
if __name__ == "__main__":
main()
Описание BaseHTTPServer
Комментариев нет:
Отправить комментарий