htaccess & urllib

Rene Pijlman at
Wed Jul 23 17:55:38 CEST 2003

Max Khesin:
>Is there a way to access an htaccess-protected directory with urllib,
>password being known?

.htaccess is not a protection mechanism, but a configuration
file. If this configuration file specifies HTTP Basic
Authentication you can use:

"class FancyURLopener(...) 
basic HTTP authentication is performed ...
Note: When performing basic authentication, a FancyURLopener
instance calls its prompt_user_passwd() method. The default
implementation asks the users for the required information on
the controlling terminal. A subclass may override this method to
support more appropriate behavior if needed."

René Pijlman

More information about the Python-list mailing list