Modifying .htpasswd from Python?

Paul Boddie paulb at infercor.no
Mon Jan 22 05:28:47 EST 2001


Gustaf Liljegren wrote:
> 
> michael at stroeder.com (Michael Ströder) wrote:
> 
> >Gustaf Liljegren wrote:
> >>
> >> This can be done easily in Perl, using the crypt() function. Now I
> >> need a Python function doing exactly the same encryption as the
> >> htpasswd command.
> >
> >See module crypt.
> 
> I saw it, but couldn't import it, and by the docs it seems to be only
> decrypting.

At least in Python 1.5.2, the 'crypt' module isn't automatically built.
If you built Python from source, you could take a look at the
'Modules/Setup' file and see if there's a line like this:

#crypt cryptmodule.c # -lcrypt  # crypt(3); needs -lcrypt on some systems

If so, remove the '#', tailor the link options (which will depend on
your operating system and where the libraries are to be found), then
build (and install) Python again. I think that should work.

Regards,

Paul



More information about the Python-list mailing list