Getting User Name With Apache Basic Authentication

Oleg Broytmann phd at phd.pp.ru
Fri Aug 24 04:02:22 EDT 2001


On Thu, 23 Aug 2001, Kurt Jansen wrote:
> I would like to set up password protected directories for my Web site
> (Apache) using the htpasswd/.htaccess.  This means that whenever a user
> requests a page in the protected directory, they get prompted for a
> userid/password.  I would like to capture the userid that the user enters
> from within my Python CGI script.  This seems like it would be a common
> thing to do, but I can't find anything in the Python library or this
> newsgroup that addresses it.  Anyone have any suggestions?

   It has nothing with Python library. User name is available to a CGI
program in OS environment. Just read CGI specification and figure it out.
The variable name is REMOTE_USER. I hope you can read env vars in Python.

Oleg.
----
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.





More information about the Python-list mailing list