wsgiauth でBasic認証
WSGI認証ミドルウェアライブラリwsgiauthを使ってBasic認証
http://cheeseshop.python.org/pypi/wsgiauth
ドキュメントが見つからない*1ので、ソースから使い方をチェック。
from wsgiauth import basic realm = "wsigh auth test" def authfunc(env, user, passwd): return user == passwd @basic.basic(realm, authfunc) def app(env, start_response): start_response("200 OK", [("Content-type", 'text/html')]) return ["Hello, world"] from wsgiref.simple_server import make_server, demo_app httpd = make_server('', 8080, app) httpd.serve_forever()
Basic認証以外にもDigest認証やopenIDにも対応しているようだ。
まだ0.1だけど先が楽しみ。
*1:見つけた方教えてください。