Python Forum
Add password to HTTP.server - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Networking (https://python-forum.io/forum-12.html)
+--- Thread: Add password to HTTP.server (/thread-11542.html)



Add password to HTTP.server - edgarfinchley - Jul-14-2018

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()



RE: Add password to HTTP.server - nilamo - Aug-09-2018

https://github.com/tianhuil/SimpleHTTPAuthServer/blob/master/SimpleHTTPAuthServer/__main__.py