cgi authentication
Dan Grassi
Dan at Grassi.com
Tue Sep 21 16:03:39 EDT 1999
I need to do authentication from Python, for various reasons using Apache
and .htaccess is not a workable solution. I can get the request to show up
with the following code but I can not figure out how to access the returned
name/password pair. Yes, I have looked hard for the info on the web and in
the books. "-)
Can anyone help?
-----
#!/usr/bin/python
import cgi
sys.stderr = sys.stdout
import os
if not os.environ.has_key("REMOTE_USER"):
print "Status: 401 Authenication Required"
print "WWW-Authenticate: Basic realm=\"Mine\""
print "Content-type: text/html"
print
print "Failed"
else:
print "Content-Type: text/plain"
print
print "Worked"
-----
More information about the Python-list
mailing list