Python Forum

Full Version: Add password to HTTP.server
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am playing about with the python 3 http server which works very well, but I need to add a simple user:password combination but have absolutely no idea how. Pointers most welcome. Thank you.


Quote:import http.server
import socketserver

PORT = 8080

Handler = http.server.SimpleHTTPRequestHandler

with socketserver.TCPServer(("", PORT), Handler) as httpd:
print("serving at port", PORT)
httpd.serve_forever()