Module for Python 3 to access LDAP directory servers.
Project description
This is a module for handling LDAP operations in Python. Uses libldap2 on Unix platforms and WinLDAP on Microsoft Windows. LDAP entries are mapped to a special Python case-insensitive dictionary, tracking the changes of the dictionary to modify the entry on the server easily.
Supports only Python 3.3 or newer, and LDAPv3.
Requirements for building
python3.3-dev or newer
libldap2-dev
libsasl2-dev
libkrb5-dev or heimdal-dev (optional)
Features
Uses LDAP libraries (OpenLDAP and WinLDAP) written in C for faster processing.
Simple pythonic design.
Implements an own dictionary-like object for mapping LDAP entries that makes easier to add and modify them.
Works with various asynchronous library (like asyncio, gevent).
Documentation
Documentation is available online with a simple tutorial.
Example
Simple search and modify:
import bonsai
client = bonsai.LDAPClient("ldap://localhost")
client.set_credentials("SIMPLE", ("cn=admin,dc=bonsai,dc=test", "secret"))
with client.connect() as conn:
res = conn.search("ou=nerdherd,dc=bonsai,dc=test", 2, "(cn=chuck)")
res[0]['givenname'] = "Charles"
res[0]['sn'] = "Carmichael"
res[0].modify()
Using with asnycio:
import asyncio
import bonsai
@asyncio.coroutine
def do():
client = bonsai.LDAPClient("ldap://localhost")
client.set_credentials("DIGEST-MD5", ("admin", "secret", None, None))
with (yield from client.connect(is_async=True)) as conn:
res = yield from conn.search("ou=nerdherd,dc=bonsai,dc=test", 2)
print(res)
who = yield from conn.whoami()
print(who)
Changelog
Currently, you can read the changelog here.
Contribution
Any contributions and advices are welcome. Please report any issues at the GitHub page.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file bonsai-0.8.8.zip
.
File metadata
- Download URL: bonsai-0.8.8.zip
- Upload date:
- Size: 128.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 957c4e78db53c0c7ecc87da1d631791b02a17f5180a92471c937182466ced4c3 |
|
MD5 | 80ccd58966296dcfa02df6cd0f48ddd9 |
|
BLAKE2b-256 | f80d71cccbbbf9a91dca953ad93bdbbc32cda4eb5be481469f2d9a2a7f80d1de |
File details
Details for the file bonsai-0.8.8.tar.gz
.
File metadata
- Download URL: bonsai-0.8.8.tar.gz
- Upload date:
- Size: 98.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c13f5b509f294ea607f71a0e88c1d02dc5c5299a2136c9ec028a5d53bc96e147 |
|
MD5 | d83edcb67dda598ec0b827b989472a53 |
|
BLAKE2b-256 | 9f9af6f6222a0ea789dbd9e7b533735c67fba8e435ef92f1fbc3b83feb045766 |
File details
Details for the file bonsai-0.8.8.win-amd64-py3.5.msi
.
File metadata
- Download URL: bonsai-0.8.8.win-amd64-py3.5.msi
- Upload date:
- Size: 155.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c6793f2895d29d5dd4cc52eac14cca1ef6b4a07ef3f8d1935ee09006b18caa5 |
|
MD5 | c690f745dd5ac38d51fda5860fa33960 |
|
BLAKE2b-256 | e1b95b4ae000e316a72a034700a817f74634bfb0878ea8c0de4b9f4e0d92130f |
File details
Details for the file bonsai-0.8.8.win-amd64-py3.4.msi
.
File metadata
- Download URL: bonsai-0.8.8.win-amd64-py3.4.msi
- Upload date:
- Size: 143.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5439a74d76bf6fa8489721397c79ca95479c31a499569537d1f1af302c60d26 |
|
MD5 | 63b5965705ca1bf258dc48024b246646 |
|
BLAKE2b-256 | 587f8b4e09969dbd7db49eb0cb68af6a3f3d7b7161962241c2a62c69cd8d6303 |
File details
Details for the file bonsai-0.8.8.win32-py3.5.msi
.
File metadata
- Download URL: bonsai-0.8.8.win32-py3.5.msi
- Upload date:
- Size: 147.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ebe228471e32ae98940db9526c746a07d6ce5fd84d71df564dfc1580b4a1286 |
|
MD5 | 9b3430a4e394efca5ca3073623671c80 |
|
BLAKE2b-256 | e57e94a94dceafa8a01d9f4da331f06295f50d2441ed61891ac3a991d60d9d4a |
File details
Details for the file bonsai-0.8.8.win32-py3.4.msi
.
File metadata
- Download URL: bonsai-0.8.8.win32-py3.4.msi
- Upload date:
- Size: 139.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a05e85bf42f59d7beca7a76a4b71138106c5e276db4143df03cfa402b7e5a06d |
|
MD5 | 6965df47be45f06992cb7de97650367f |
|
BLAKE2b-256 | 74d5615fab0ee08730bfc277628537f6284a984c03fce0ffe6f7dc991ee58ebb |
File details
Details for the file bonsai-0.8.8-cp35-cp35m-win_amd64.whl
.
File metadata
- Download URL: bonsai-0.8.8-cp35-cp35m-win_amd64.whl
- Upload date:
- Size: 61.1 kB
- Tags: CPython 3.5m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 935c64e3bd6a606b9bdc466c52704ee37bcb396ff247ce7e08d6a36dffab5355 |
|
MD5 | d48b9387694acc8834583c8410e628ae |
|
BLAKE2b-256 | 3929b45cf7d8e58e49180584c2685b1531ba59bd96d67a86f65c82747fa2d5c9 |
File details
Details for the file bonsai-0.8.8-cp35-cp35m-win32.whl
.
File metadata
- Download URL: bonsai-0.8.8-cp35-cp35m-win32.whl
- Upload date:
- Size: 53.3 kB
- Tags: CPython 3.5m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a42616c3196d29a0634534a3df13b3350b235313d4a904ac8f5050d0093a5d0b |
|
MD5 | 02e904f9c80b1fb1a856944225aacd33 |
|
BLAKE2b-256 | 33729c46474b47ce7dcc477a32a2f7aa25bdb20bf2c0ed2545176437259d5dc3 |
File details
Details for the file bonsai-0.8.8-cp35-cp35m-macosx_10_11_x86_64.whl
.
File metadata
- Download URL: bonsai-0.8.8-cp35-cp35m-macosx_10_11_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.5m, macOS 10.11+ x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 244f94735d30ba0cc67ee0379b75f02b8a9be9e0e07c90317974ef21ecc043b7 |
|
MD5 | f159b5de5fbda0b925c1318c29be3138 |
|
BLAKE2b-256 | 5ccfe763c82a06eb314f8e6299949fea26985f1a8f4234a5d613346a3cd58ec7 |
File details
Details for the file bonsai-0.8.8-cp34-cp34m-win_amd64.whl
.
File metadata
- Download URL: bonsai-0.8.8-cp34-cp34m-win_amd64.whl
- Upload date:
- Size: 55.4 kB
- Tags: CPython 3.4m, Windows x86-64
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a50520028d6047c9c649c9510e40a565ba7eab4d09ce8511a544768227652dc0 |
|
MD5 | b7738713c9311951df9e5a4609b1ac74 |
|
BLAKE2b-256 | 3c4a466b4d5330d9d44673be32e41ddac7ad50ef993251d867f82a9e51dc2a1b |
File details
Details for the file bonsai-0.8.8-cp34-cp34m-win32.whl
.
File metadata
- Download URL: bonsai-0.8.8-cp34-cp34m-win32.whl
- Upload date:
- Size: 50.0 kB
- Tags: CPython 3.4m, Windows x86
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11efd397fb89b485476eefc6d0103021e6a1c8a7ad71939c47dc286ec01c90d2 |
|
MD5 | 730bda10bfdd19d247d9b0e1d8549565 |
|
BLAKE2b-256 | 3a9fa07009e48d6dd853cf516bf079c2b134a7c2d22c82d4721187fe6d264a8f |