Bonsai
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.10 or newer, and LDAPv3.
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).
Requirements for building
python3.10-dev or newer
libldap2-dev
libsasl2-dev
libkrb5-dev or heimdal-dev (optional)
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", user="cn=admin,dc=bonsai,dc=test", password="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 asyncio:
import asyncio
import bonsai
async def do():
client = bonsai.LDAPClient("ldap://localhost")
client.set_credentials("DIGEST-MD5", user="admin", password="secret")
async with client.connect(is_async=True) as conn:
res = await conn.search("ou=nerdherd,dc=bonsai,dc=test", 2)
print(res)
who = await conn.whoami()
print(who)
asyncio.run(do())
Changelog
The changelog is available here and included in the documentation as well.
Contribution
Any contributions and advices are welcome. Please report any issues at the GitHub page.
Metadata
Release files for bonsai 1.5.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bonsai-1.5.5.tar.gz | 151.2 kB | Details |
Built distributions (wheels)
Total release size: 28.9 MB
Release files / bonsai-1.5.5.tar.gz
| Download URL | bonsai-1.5.5.tar.gz |
|---|---|
| Size | 151.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
417d2c28ec91af0300c9715cc724b84a79ec3b471bc41d3a0a71009fae0cb022
|
|
BLAKE2b-256 checksum How to use checksums |
754e5572ad9689c8b04759ffa53dfcb0784524cc2e9f7884f67ed681508d6763
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp314-cp314-win_amd64.whl
| Download URL | bonsai-1.5.5-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 88.8 kB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8b8df73b61c74d819a06cacd9df8a61e1a13e84a9fca091fd1661bb2ca7aaa4f
|
|
BLAKE2b-256 checksum How to use checksums |
43e5bc67ee45881e0fcd64542669ef90d5a49ffabae17b408a068857e2577659
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp314-cp314-win32.whl
| Download URL | bonsai-1.5.5-cp314-cp314-win32.whl |
|---|---|
| Size | 82.9 kB |
| Tags | CPython 3.14 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
2517590867ef77cdaaa1ceee2411703f5f1b14e1938786d7855d0a45ec835d3d
|
|
BLAKE2b-256 checksum How to use checksums |
f5217092fa42ee0323bae7731ceff384fe909ea4ee333fe478b1e19528aebb67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp314-cp314-macosx_15_0_x86_64.whl
| Download URL | bonsai-1.5.5-cp314-cp314-macosx_15_0_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.14 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
e822a8e0a02a10ee2dc2276a43538d67ab1fa4974a33f34cb763b246db6d52f7
|
|
BLAKE2b-256 checksum How to use checksums |
245c03e14ba11d1f8ff226b957f00d69cddf349a13ba1c0228bb51eb965f9f82
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp314-cp314-macosx_14_0_arm64.whl
| Download URL | bonsai-1.5.5-cp314-cp314-macosx_14_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.14 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
7da307dcf0d796ab6594aabe7dc2248a58146e60e1513f0349cc5d8c7102ee55
|
|
BLAKE2b-256 checksum How to use checksums |
ebb546f4b7b14a546ed6d1ba6b0653101a27253338d22f603c1a07c866f49dcd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp313-cp313-win_amd64.whl
| Download URL | bonsai-1.5.5-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 87.6 kB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
8d0d41db8b6cf9e3f78122ae92c98f0785a8c87cf6e5929b59b36836df666b44
|
|
BLAKE2b-256 checksum How to use checksums |
321b1d1a6b2bf8009afb6df9bf4b9318da5503e36364e83d7d826bd77002fb6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp313-cp313-win32.whl
| Download URL | bonsai-1.5.5-cp313-cp313-win32.whl |
|---|---|
| Size | 81.9 kB |
| Tags | CPython 3.13 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
ca619376ac52c97cbe785e4ccfabda2a3a9d3c3f55da8cd304753de0eb356be0
|
|
BLAKE2b-256 checksum How to use checksums |
d9452dce7b3189139e75f3679a1849bdb3f8c5836a429ffc201d10d4601f8d8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp313-cp313-macosx_15_0_x86_64.whl
| Download URL | bonsai-1.5.5-cp313-cp313-macosx_15_0_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.13 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
e3ea37384e6af87517b7fb467acca8001580afa47644b572c2a881206524c52b
|
|
BLAKE2b-256 checksum How to use checksums |
37c2a51eb5cfded2e5481f2ce131f0e55d798c02f7f78eb589102791ee1d6b05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp313-cp313-macosx_14_0_arm64.whl
| Download URL | bonsai-1.5.5-cp313-cp313-macosx_14_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.13 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
850933a9cf5d918b14b9b2bfa4d28e8f39f55140f861a0163c8c7f7d7142d641
|
|
BLAKE2b-256 checksum How to use checksums |
f93aaf631be0af15e05eeab7bbd83ec0b0f6efc64bd268d8e778aa7b68d2565a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp312-cp312-win_amd64.whl
| Download URL | bonsai-1.5.5-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 87.6 kB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
5c941199b8349761c207366013e4481df52d99c83e6c10ed1372de890ea230f3
|
|
BLAKE2b-256 checksum How to use checksums |
ff25879240de216efdeec5f4bf43698ce214e90c474f4bc27e5998e65b60015b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp312-cp312-win32.whl
| Download URL | bonsai-1.5.5-cp312-cp312-win32.whl |
|---|---|
| Size | 81.9 kB |
| Tags | CPython 3.12 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
fb9a1fcf149fb3fdabfc33a24aad0c1485a88bf619e5a36b7f0898d11b7cd03e
|
|
BLAKE2b-256 checksum How to use checksums |
0c1d1bb05940c6fa3c18bf34e192a59474af0fd62c8d8452be8f1581d55eced1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp312-cp312-macosx_15_0_x86_64.whl
| Download URL | bonsai-1.5.5-cp312-cp312-macosx_15_0_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.12 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
b9a6385e21c549b4ff75fa8e946bd5b08c8891e8cdf6b1c5a72baf47a3e1338b
|
|
BLAKE2b-256 checksum How to use checksums |
7934a752063a9de4cf08c1b200d212b49ee74e84169ce0bcab9f2e9a2f9d2f23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp312-cp312-macosx_14_0_arm64.whl
| Download URL | bonsai-1.5.5-cp312-cp312-macosx_14_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.12 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1b9d8228b3ae334dd3f9bde6bcc81fc432b07da6aacd4b2de8085b40b6f3aa5b
|
|
BLAKE2b-256 checksum How to use checksums |
3f278fca017575cc05e4074848f6c295e1c745596c09b4f8fb8a0d5881c23ec1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp311-cp311-win_amd64.whl
| Download URL | bonsai-1.5.5-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 87.2 kB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
2e04a7d7c35c527e92b1835b43063a448c24e01b87b41cd54257ca0a04e24dd6
|
|
BLAKE2b-256 checksum How to use checksums |
5a01866e886a5b0bd99badff82d2e737e0ad9c1111d7ed73756f4e78d0787f10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp311-cp311-win32.whl
| Download URL | bonsai-1.5.5-cp311-cp311-win32.whl |
|---|---|
| Size | 81.4 kB |
| Tags | CPython 3.11 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
77ce92cee2136fe87643e5c5f89f096f384a8a801988416fad78c5fb98e4b746
|
|
BLAKE2b-256 checksum How to use checksums |
7a57dec11e4b1fe6bc29d81c98e3ce6be78d34bb3d87651f5376ff328f5627b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp311-cp311-macosx_15_0_x86_64.whl
| Download URL | bonsai-1.5.5-cp311-cp311-macosx_15_0_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.11 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
8ebaedbc3c344887f70b890d3e38f28509254ce4c5f622f6b2cc96f209de949f
|
|
BLAKE2b-256 checksum How to use checksums |
9b4d2e6569bc18dcf7cb1d48b544fb1157eeb881ddfe9492fde13b15a533764f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp311-cp311-macosx_14_0_arm64.whl
| Download URL | bonsai-1.5.5-cp311-cp311-macosx_14_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.11 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
28b49661a8e7e0bdec58048c473154bec4fbe151cb4c91bb3de7c3b9acddcd6e
|
|
BLAKE2b-256 checksum How to use checksums |
1a30b6875918d483b1884be9391d0402b35386dd1d48e47269513391d28f72a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp310-cp310-win_amd64.whl
| Download URL | bonsai-1.5.5-cp310-cp310-win_amd64.whl |
|---|---|
| Size | 87.2 kB |
| Tags | CPython 3.10 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
404cf47b5da153a6a88fe7a6f34fbbbb14351e742547ea683953fdaee4b22ce3
|
|
BLAKE2b-256 checksum How to use checksums |
67d8e414ac99a06f15ca60f0c5ff921eab9278601a3abfae8227ca8c571de23e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp310-cp310-win32.whl
| Download URL | bonsai-1.5.5-cp310-cp310-win32.whl |
|---|---|
| Size | 81.4 kB |
| Tags | CPython 3.10 Windows x86-32 |
|
SHA-256 checksum How to use checksums |
c1aa689417325ef40fd20481b00bbf4478178dcda7dfdff7348a6cb172065f2d
|
|
BLAKE2b-256 checksum How to use checksums |
364c1a463030fd3f3e5135694c5eab4ca46e7053779f957f8f4aa70ad371757e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp310-cp310-macosx_15_0_x86_64.whl
| Download URL | bonsai-1.5.5-cp310-cp310-macosx_15_0_x86_64.whl |
|---|---|
| Size | 2.7 MB |
| Tags | CPython 3.10 macOS 15.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
c3c7845a4c7a361108d80c1ac6718a9d37593b8e975635e02bdd02000fc2511d
|
|
BLAKE2b-256 checksum How to use checksums |
c46dbb86424b36d6be5f6bfd723bc5185cd90bc761b819dda98b03782e931558
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / bonsai-1.5.5-cp310-cp310-macosx_14_0_arm64.whl
| Download URL | bonsai-1.5.5-cp310-cp310-macosx_14_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.10 macOS 14.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
12918054549ef567d792e7b5083bd257f98339b11b5a4f49dd717273c84f55f8
|
|
BLAKE2b-256 checksum How to use checksums |
5276c39edb35dfaf60603afec0e0e51fc163cc21175cee403fe281bc4d577b9c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|