Advertisement
metalx1000

Basic Python HTTP server set to loopback only localhost

Nov 6th, 2014
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. import BaseHTTPServer
  4. from SimpleHTTPServer import SimpleHTTPRequestHandler
  5.  
  6. Handler = SimpleHTTPRequestHandler
  7. Server  = BaseHTTPServer.HTTPServer
  8.  
  9. address = ('127.0.0.1', 8000)
  10.  
  11. Handler.protocol_version = "HTTP/1.0"
  12. httpd = Server(address, Handler)
  13.  
  14. info = httpd.socket.getsockname()
  15. print "HTTP running on", info[0], "port", info[1], "..."
  16. httpd.serve_forever()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement