from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler

print "hello "


class TestHTTPHandle(BaseHTTPRequestHandler): 
def do_GET(self): 

print self.client_address
print self.command

buf = 'It works'

self.protocal_version = "HTTP/1.1" 

print "yes no"

self.send_response(200) 

self.send_header("Welcome", "Contect") 

self.end_headers() 

self.wfile.write(buf)
def do_POST(self): 
buf = 'yes'


def start_server(port): 
#Create the pbject and server requests
# serveaddr=('',8000)
# httpd=HTTPServer(serveaddr,TestHTTPHandler)
# print "Base serve is start add is %s port is %d"%(serveaddr[0],serveaddr[1])
# httpd.serve_forever()


# handle = TestHTTPHandle()

http_server = HTTPServer(('127.0.0.1', int(port)), TestHTTPHandle) 
http_server.serve_forever()
print "start server"

start_server(8000)