wasm-demo/demo/ermis-f/python_m/cur/0091

37 lines
1.2 KiB
Plaintext
Raw Permalink Normal View History

From: mli389 at merle.acns.nwu.edu (Matthew T Lineen)
Date: 15 Apr 1999 20:40:30 GMT
Subject: HTML Authentication with Python
Message-ID: <7f5iru$rlm@news.acns.nwu.edu>
X-UID: 91
I am currently running python on an Windows NT Server. We only want certain
pages to be accessed by people with accounts on the server in order to
update a database through python. Using this code:
def main():
if not os.environ.has_key("REMOTE_USER"):
print "HTTP/1.0 401 Access Denied"
print "Status: 401 Authenication Required"
print "WWW-authenticate: Basic;"
print "Content-type: text/html\n\n\n"
else:
print "Worked"
I was able to get an authentication box to pop up in both netscape and ie,
but when a user who is not an administrator tries to authenticate it
doesn't accept the username / password.
Is this a good way to go about authentication in python or is there another
library to interface with the browsers and the NT user database?
Furthermore, I'm relatively sure that the problem lies in user permissions,
but I have no idea where to begin troubleshooting. Where is the os.environ
'kept'?
Any help would be appriciated.
Matthew Lineen