Library to work with htpasswd user (basic authorization) and group files.
Project description
# htpasswd
## Description htpasswd is a library for working with htpasswd user (only basic authorization) and group files.
## Dependencies - Python 2.6 or 2.7 - [orderedmultidict](http://pypi.python.org/pypi/orderedmultidict/0.7) >= 0.7
- ## Sample usage
import htpasswd
- with htpasswd.Basic(“/path/to/user.db”) as userdb:
- try:
userdb.add_user(“bob”, “password”)
- except htpasswd.basic.UserExists, e:
print e
- try:
userdb.change_password(“alice”, “newpassword”)
- except htpasswd.basic.UserNotExists, e:
print e
- with htpasswd.Group(“/path/to/group.db”) as groupdb:
- try:
groupdb.add_user_to_group(“bob”, “admins”)
- except htpasswd.group.UserAlreadyInAGroup, e:
print e
- try:
groupdb.delete_user_from_group(“alice”, “managers”)
- except htpasswd.group.UserNotInAGroup, e:
print e
## Provided methods
### Basic - show_users() - is_user_exists(user) - add_user(user, password) - delete_user(user) - change_password(user, password) - _crypt_password(password)
### Group - show_groups() - is_group_exists(group) - is_user_in_a_group(user, group) - add_user_to_group(user, group) - delete_user_from_group(user, group)
## Exceptions
### HtException
That’s a general exception from which others are inherited.
### UserExists Raised by add_user if user already exists.
### UserNotExists Raised by delete_user and change_password if there is no such user.
### GroupNotExists Raised by delete_user_from_group if there is no such group.
### UserAlreadyInAGroup Raised by add_user_to_group if user is already in a group.
### UserNotInAGroup Raised by delete_user_from_group if user isn’t in a group.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file htpasswd-1.0.tar.gz.
File metadata
- Download URL: htpasswd-1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac123b50fcc5e854d3e38d2125e9fcc89b383a8dfea3c90079486ea298e65e45
|
|
| MD5 |
a4a133a97f979a07e24d06e2e929c136
|
|
| BLAKE2b-256 |
536c5d0cffbb83155397773c79c555b8e9987d472674eb823a44e4a5bfe48040
|