Return to Snippet

Revision: 17587
at September 10, 2009 03:15 by manatlan


Initial Code
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer

class MyServer(BaseHTTPRequestHandler):
    def do_GET(self):
        self.send_response(200, 'OK')
        self.send_header('Content-type', 'text/html')
        self.end_headers()
        self.wfile.write( "hello" )

    @staticmethod
    def serve_forever(port):
        HTTPServer(('', port), MyServer).serve_forever()

if __name__ == "__main__":
    MyServer.serve_forever(8080)

Initial URL

                                

Initial Description

                                

Initial Title
simple httpserver

Initial Tags
http, server, python, web

Initial Language
Python