SHARE
TWEET

Untitled

a guest Jan 10th, 2014 106 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import sys
  2. import BaseHTTPServer
  3. from SimpleHTTPServer import SimpleHTTPRequestHandler
  4.  
  5.  
  6. HandlerClass = SimpleHTTPRequestHandler
  7. ServerClass  = BaseHTTPServer.HTTPServer
  8. Protocol     = "HTTP/1.0"
  9.  
  10. if sys.argv[1:]:
  11.     port = int(sys.argv[1])
  12. else:
  13.     port = 8000
  14. server_address = ('127.0.0.1', port)
  15.  
  16. HandlerClass.protocol_version = Protocol
  17. httpd = ServerClass(server_address, HandlerClass)
  18.  
  19. sa = httpd.socket.getsockname()
  20. print "Serving HTTP on", sa[0], "port", sa[1], "..."
  21. httpd.serve_forever()
RAW Paste Data
Top