skip420

http-server

Sep 23rd, 2021
1,944
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # a very simple http-server
  2. # python3 http-server.py
  3. # localhost:8080
  4.  
  5. import http.server
  6. import socketserver
  7.  
  8. PORT = 8080
  9. Handler = http.server.SimpleHTTPRequestHandler
  10.  
  11. with socketserver.TCPServer(("", PORT), Handler) as httpd:
  12.     print("serving at port", PORT)
  13.     httpd.serve_forever()
RAW Paste Data