htpasswdLibrary to work with htpasswd user (basic authorization) and group files | |
Download |
htpasswd Ranking & Summary
Advertisement
- License:
- MIT/X Consortium Lic...
- Price:
- FREE
- Publisher Name:
- Ilya A. Otyutskiy
- Publisher web site:
- https://github.com/thesharp/
htpasswd Tags
htpasswd Description
htpasswd is a Python library for working with htpasswd user (only basic authorization) and group files.Sample usageimport htpasswdwith htpasswd.Basic("/path/to/user.db") as userdb: try: userdb.add("bob", "password") except htpasswd.basic.UserExists, e: print e try: userdb.change_password("alice", "newpassword") except htpasswd.basic.UserNotExists, e: print ewith htpasswd.Group("/path/to/group.db") as groupdb: try: groupdb.add_user("bob", "admins") except htpasswd.group.UserAlreadyInAGroup, e: print e try: groupdb.delete_user("alice", "managers") except htpasswd.group.UserNotInAGroup, e: print eProvided methodsBasic __contains__(user) users add(user, password) delete(user) change_password(user, password) _crypt_password(password)Group __contains__(group) groups is_user_in(user, group) add_user(user, group) delete_user(user, group)ExceptionsHtExceptionThat's a general exception from which others are inherited.UserExistsRaised by Basic.add if user already exists.UserNotExistsRaised by Basic.delete and Basic.change_password if there is no such user.GroupNotExistsRaised by Group.delete_user if there is no such group.UserAlreadyInAGroupRaised by Group.add_user if user is already in a group.UserNotInAGroupRaised by Group.delete_user if user isn't in a group.Product's homepage
htpasswd Related Software