Basic authentication with simplehttpserver

南楼画角 提交于 2020-05-16 06:10:52

问题


Is it possible to add a basic authentication with simplehttpserver ?

I would like to restrict the access to a website using SimpleHTTPServer


回答1:


I recently wrote sauth for this reason. It's just humanized and properly packaged version of https://github.com/tianhuil/SimpleHTTPAuthServer with python3 support.

Try it:

~$ pip install sauth
~$ cd some_dir
~/some_dir $ sauth admin 12345 
Serving "/home/user/some_dir" directory on http://0.0.0.0:8333



回答2:


This does it: https://github.com/tianhuil/SimpleHTTPAuthServer

Which is based upon this gist: https://gist.github.com/fxsjy/5465353



来源:https://stackoverflow.com/questions/42736667/basic-authentication-with-simplehttpserver

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!