File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import time
2+ import BaseHTTPServer
3+
4+
5+ HOST = 'localhost' # set you host
6+ PORT = 31337 # set your port
7+
8+
9+ class Server (BaseHTTPServer .BaseHTTPRequestHandler ):
10+
11+ def do_HEAD (s ):
12+ s .send_response (200 )
13+ s .send_header ("Content-type" , "text/html" )
14+ s .end_headers ()
15+
16+ def do_GET (s ):
17+ s .send_response (200 )
18+ s .send_header ("Content-type" , "text/html" )
19+ s .end_headers ()
20+ s .wfile .write ("<html><head><title>Titles.</title></head>" )
21+ s .wfile .write ("<body><p>and stuff.</p>" )
22+ s .wfile .write ("</body></html>" )
23+
24+ if __name__ == '__main__' :
25+ server_class = BaseHTTPServer .HTTPServer
26+ httpd = server_class ((HOST , PORT ), Server )
27+ print time .asctime (), "Server On - %s:%s" % (HOST , PORT )
28+ try :
29+ httpd .serve_forever ()
30+ except KeyboardInterrupt :
31+ pass
32+ httpd .server_close ()
33+ print time .asctime (), "Server Off - %s:%s" % (HOST , PORT )
You can’t perform that action at this time.
0 commit comments