Python 3 module for accessing 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.5 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.5-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 (on Python 3.5 or newer):
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)
loop = asyncio.get_event_loop()
loop.run_until_complete(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.
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 Distribution
Built Distributions
File details
Details for the file bonsai-1.2.0.tar.gz
.
File metadata
- Download URL: bonsai-1.2.0.tar.gz
- Upload date:
- Size: 125.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd9a3d4c7ff668cdd04b8e68d67e186e7124e2262da149c3dbc78d1aa0a16b04 |
|
MD5 | c7402f58d3045261cbf09fd02b083151 |
|
BLAKE2b-256 | fec4a669c2dadf22fa3b034d3270d4f20a904e2bbe51eaa14543e67a3f7a9465 |
File details
Details for the file bonsai-1.2.0.win-amd64-py3.8.exe
.
File metadata
- Download URL: bonsai-1.2.0.win-amd64-py3.8.exe
- Upload date:
- Size: 666.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9c116ed3e553fb46ecd1cb3c42799e395d517ad044a1988614556510c1ff229 |
|
MD5 | d2e4480a8292bc7e082e6a7c07c21777 |
|
BLAKE2b-256 | 8e9a4596936895060b1ccad920da147172a3beb0d515d499de6a4698c28a6372 |
File details
Details for the file bonsai-1.2.0.win-amd64-py3.7.exe
.
File metadata
- Download URL: bonsai-1.2.0.win-amd64-py3.7.exe
- Upload date:
- Size: 666.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86dad31ad4260d7812832b59a75872602960739ed77961dcd89d7112b5278b67 |
|
MD5 | b01a626312b84b8de985a654189badc6 |
|
BLAKE2b-256 | e643d1ee4b546a01a3f5c4d1872b1706fe4e7e73ebd426cd86ed0143160644ed |
File details
Details for the file bonsai-1.2.0.win-amd64-py3.6.exe
.
File metadata
- Download URL: bonsai-1.2.0.win-amd64-py3.6.exe
- Upload date:
- Size: 666.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 42477259176ffcc4ecc3e2195fbaaee29ad5d73d17c2b1bda4d91b26bcb17075 |
|
MD5 | 546dd92763af7738000c1e6c6ccb867e |
|
BLAKE2b-256 | 415b081fc708f1947a54c73bc290055bde003f23c4861e4020f396de8029f2b0 |
File details
Details for the file bonsai-1.2.0.win32-py3.8.exe
.
File metadata
- Download URL: bonsai-1.2.0.win32-py3.8.exe
- Upload date:
- Size: 529.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83dde90bbe3f5957c6f987c0aceffd606ce14f494bfb56be2ddb633ae311ebdb |
|
MD5 | 179b9b0287edac76f8320537c5d66d92 |
|
BLAKE2b-256 | fad48bf2580dc4f2545dd2eb932f91c36512eff4f1e4c2150b5eabfa38ca8bb7 |
File details
Details for the file bonsai-1.2.0.win32-py3.7.exe
.
File metadata
- Download URL: bonsai-1.2.0.win32-py3.7.exe
- Upload date:
- Size: 529.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2bcbb02b5483a32739541f72f750a17bc28467eca1a286604b9b80bf8309225 |
|
MD5 | 5d29455042afac2c351cfeab45600ff3 |
|
BLAKE2b-256 | b8e6fa016ebc80e57ca9421c93258ea84383e6e1a139f935687da63f37d9f034 |
File details
Details for the file bonsai-1.2.0.win32-py3.6.exe
.
File metadata
- Download URL: bonsai-1.2.0.win32-py3.6.exe
- Upload date:
- Size: 529.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 482c5ba1db3dc87daa6b8fa792269060db20115a37bcd84412b75c7c2b780132 |
|
MD5 | 1072d96e60a922b1a46e35d706c1dd16 |
|
BLAKE2b-256 | d2723d082039b0397c9ae727bf26d8858c898d67186a9802f1b29be3d825e1f8 |
File details
Details for the file bonsai-1.2.0-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: bonsai-1.2.0-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 75.0 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91585832da3e465b46d3690091872c94239bb12a2db72c59265c4333bb272de0 |
|
MD5 | 4e540c4e21f96be4405332dffb42d359 |
|
BLAKE2b-256 | 1d14700968273e662c275e05734f03b770d867c8c378926559b1c37b8eae2ca7 |
File details
Details for the file bonsai-1.2.0-cp38-cp38-win32.whl
.
File metadata
- Download URL: bonsai-1.2.0-cp38-cp38-win32.whl
- Upload date:
- Size: 67.5 kB
- Tags: CPython 3.8, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45bb556e33ff57466e7e70a137afc984231b79edb7df2d4a65210d1c4f53bd0a |
|
MD5 | 8bc16614977cf62a115ea3a2b219c7a8 |
|
BLAKE2b-256 | a4178a25871931299597336b002bc43e6455fc2c2892325e4f9de9db161ef270 |
File details
Details for the file bonsai-1.2.0-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: bonsai-1.2.0-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 74.4 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44de82623b765f2bb967a91c3d3a48ca578c4090682a508b9533e144575a2f2c |
|
MD5 | 3d8315af368608ff6cc029527155fc64 |
|
BLAKE2b-256 | 6a4336c75857a7fc480bbe22122a10809ccb561c6cee4f5398baf0a0a069d0cf |
File details
Details for the file bonsai-1.2.0-cp37-cp37m-win32.whl
.
File metadata
- Download URL: bonsai-1.2.0-cp37-cp37m-win32.whl
- Upload date:
- Size: 66.9 kB
- Tags: CPython 3.7m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 220002bd80722ee45eaa802c87b411160b8ae5bd792d6e7aaeecbeb92b56ebb3 |
|
MD5 | 5683db258e1e9489f3cff56958c4fb13 |
|
BLAKE2b-256 | 956c9d20a94f30ca18bccc3b7929145142a527736b5e4b2cce549b64a7907eb5 |
File details
Details for the file bonsai-1.2.0-cp37-cp37m-macosx_10_14_x86_64.whl
.
File metadata
- Download URL: bonsai-1.2.0-cp37-cp37m-macosx_10_14_x86_64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.7m, macOS 10.14+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2df864cdda584d0902f4ddb3184bb67cbb6b27a1572b8eeb42d0ab89c229bb3c |
|
MD5 | 546e65abdb4c3b005fd199aab0a9f654 |
|
BLAKE2b-256 | 8b42ea2241152b2ab4d8a430801a45843aef13324d1cef266add9b4747f9d65d |
File details
Details for the file bonsai-1.2.0-cp36-cp36m-win_amd64.whl
.
File metadata
- Download URL: bonsai-1.2.0-cp36-cp36m-win_amd64.whl
- Upload date:
- Size: 74.4 kB
- Tags: CPython 3.6m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 915ed6326f5c0baf5942534d874fd9f8063e689ec681af24815f523d7434f093 |
|
MD5 | 9b9d37af3965cb4afd8cb6c18e63ad54 |
|
BLAKE2b-256 | cc1d7ea18e1a96c1275761814ecfd4a4b84e47a77c23999467c1d88b670d5368 |
File details
Details for the file bonsai-1.2.0-cp36-cp36m-win32.whl
.
File metadata
- Download URL: bonsai-1.2.0-cp36-cp36m-win32.whl
- Upload date:
- Size: 66.9 kB
- Tags: CPython 3.6m, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.4.2 requests/2.22.0 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f8c8bb3ae9cd514a046aa6c7193ee3b67993a0f27b28a9fe4b9088fa3782e23 |
|
MD5 | 9693354a59f7ca923631e38c31e283f1 |
|
BLAKE2b-256 | 38a88af8e6d2ba6bb016b35e2540946fe36c527f7b607d856ddb182ff67d38fb |