Skip to main content

Python 3 module for accessing LDAP directory servers.

Project description

PyPI Version GitHub Action Build Status Azure Pipelines Status AppVeyor CI Build Status Coverage Status Documentation Status GitHub License

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.

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

bonsai-1.5.5.tar.gz (151.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

bonsai-1.5.5-cp314-cp314-win_amd64.whl (88.8 kB view details)

Uploaded CPython 3.14Windows x86-64

bonsai-1.5.5-cp314-cp314-win32.whl (82.9 kB view details)

Uploaded CPython 3.14Windows x86

bonsai-1.5.5-cp314-cp314-macosx_15_0_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.14macOS 15.0+ x86-64

bonsai-1.5.5-cp314-cp314-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.14macOS 14.0+ ARM64

bonsai-1.5.5-cp313-cp313-win_amd64.whl (87.6 kB view details)

Uploaded CPython 3.13Windows x86-64

bonsai-1.5.5-cp313-cp313-win32.whl (81.9 kB view details)

Uploaded CPython 3.13Windows x86

bonsai-1.5.5-cp313-cp313-macosx_15_0_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.13macOS 15.0+ x86-64

bonsai-1.5.5-cp313-cp313-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.13macOS 14.0+ ARM64

bonsai-1.5.5-cp312-cp312-win_amd64.whl (87.6 kB view details)

Uploaded CPython 3.12Windows x86-64

bonsai-1.5.5-cp312-cp312-win32.whl (81.9 kB view details)

Uploaded CPython 3.12Windows x86

bonsai-1.5.5-cp312-cp312-macosx_15_0_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.12macOS 15.0+ x86-64

bonsai-1.5.5-cp312-cp312-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.12macOS 14.0+ ARM64

bonsai-1.5.5-cp311-cp311-win_amd64.whl (87.2 kB view details)

Uploaded CPython 3.11Windows x86-64

bonsai-1.5.5-cp311-cp311-win32.whl (81.4 kB view details)

Uploaded CPython 3.11Windows x86

bonsai-1.5.5-cp311-cp311-macosx_15_0_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.11macOS 15.0+ x86-64

bonsai-1.5.5-cp311-cp311-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.11macOS 14.0+ ARM64

bonsai-1.5.5-cp310-cp310-win_amd64.whl (87.2 kB view details)

Uploaded CPython 3.10Windows x86-64

bonsai-1.5.5-cp310-cp310-win32.whl (81.4 kB view details)

Uploaded CPython 3.10Windows x86

bonsai-1.5.5-cp310-cp310-macosx_15_0_x86_64.whl (2.7 MB view details)

Uploaded CPython 3.10macOS 15.0+ x86-64

bonsai-1.5.5-cp310-cp310-macosx_14_0_arm64.whl (2.9 MB view details)

Uploaded CPython 3.10macOS 14.0+ ARM64

File details

Details for the file bonsai-1.5.5.tar.gz.

File metadata

  • Download URL: bonsai-1.5.5.tar.gz
  • Upload date:
  • Size: 151.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5.tar.gz
Algorithm Hash digest
SHA256 417d2c28ec91af0300c9715cc724b84a79ec3b471bc41d3a0a71009fae0cb022
MD5 8023099e1a7055e3a388634bd6da17b0
BLAKE2b-256 754e5572ad9689c8b04759ffa53dfcb0784524cc2e9f7884f67ed681508d6763

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp314-cp314-win_amd64.whl.

File metadata

  • Download URL: bonsai-1.5.5-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 88.8 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 8b8df73b61c74d819a06cacd9df8a61e1a13e84a9fca091fd1661bb2ca7aaa4f
MD5 7bff2328656429e9921639b8d86114b7
BLAKE2b-256 43e5bc67ee45881e0fcd64542669ef90d5a49ffabae17b408a068857e2577659

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp314-cp314-win32.whl.

File metadata

  • Download URL: bonsai-1.5.5-cp314-cp314-win32.whl
  • Upload date:
  • Size: 82.9 kB
  • Tags: CPython 3.14, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5-cp314-cp314-win32.whl
Algorithm Hash digest
SHA256 2517590867ef77cdaaa1ceee2411703f5f1b14e1938786d7855d0a45ec835d3d
MD5 aecb9ed36a91d752256be0bc45db662a
BLAKE2b-256 f5217092fa42ee0323bae7731ceff384fe909ea4ee333fe478b1e19528aebb67

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp314-cp314-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.5-cp314-cp314-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 e822a8e0a02a10ee2dc2276a43538d67ab1fa4974a33f34cb763b246db6d52f7
MD5 bfb7fc9b624877607fbbdf78fec2932f
BLAKE2b-256 245c03e14ba11d1f8ff226b957f00d69cddf349a13ba1c0228bb51eb965f9f82

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp314-cp314-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.5-cp314-cp314-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 7da307dcf0d796ab6594aabe7dc2248a58146e60e1513f0349cc5d8c7102ee55
MD5 c2fee9889016ef7c2d3e0449620e57ff
BLAKE2b-256 ebb546f4b7b14a546ed6d1ba6b0653101a27253338d22f603c1a07c866f49dcd

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: bonsai-1.5.5-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 87.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8d0d41db8b6cf9e3f78122ae92c98f0785a8c87cf6e5929b59b36836df666b44
MD5 a971d0e4c111d7967481e15e7c2ba1de
BLAKE2b-256 321b1d1a6b2bf8009afb6df9bf4b9318da5503e36364e83d7d826bd77002fb6c

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp313-cp313-win32.whl.

File metadata

  • Download URL: bonsai-1.5.5-cp313-cp313-win32.whl
  • Upload date:
  • Size: 81.9 kB
  • Tags: CPython 3.13, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 ca619376ac52c97cbe785e4ccfabda2a3a9d3c3f55da8cd304753de0eb356be0
MD5 594eeb3b30110271add1ed4c5f404f88
BLAKE2b-256 d9452dce7b3189139e75f3679a1849bdb3f8c5836a429ffc201d10d4601f8d8b

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp313-cp313-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.5-cp313-cp313-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 e3ea37384e6af87517b7fb467acca8001580afa47644b572c2a881206524c52b
MD5 22592fbc4d78ef003aff63e8007aba43
BLAKE2b-256 37c2a51eb5cfded2e5481f2ce131f0e55d798c02f7f78eb589102791ee1d6b05

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp313-cp313-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.5-cp313-cp313-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 850933a9cf5d918b14b9b2bfa4d28e8f39f55140f861a0163c8c7f7d7142d641
MD5 ef534a45db0d580124208acc09a310cb
BLAKE2b-256 f93aaf631be0af15e05eeab7bbd83ec0b0f6efc64bd268d8e778aa7b68d2565a

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: bonsai-1.5.5-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 87.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 5c941199b8349761c207366013e4481df52d99c83e6c10ed1372de890ea230f3
MD5 842a739e0997ed6cfe9e765e3465d517
BLAKE2b-256 ff25879240de216efdeec5f4bf43698ce214e90c474f4bc27e5998e65b60015b

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp312-cp312-win32.whl.

File metadata

  • Download URL: bonsai-1.5.5-cp312-cp312-win32.whl
  • Upload date:
  • Size: 81.9 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 fb9a1fcf149fb3fdabfc33a24aad0c1485a88bf619e5a36b7f0898d11b7cd03e
MD5 0a6e46bb19779483e691f99b103cfced
BLAKE2b-256 0c1d1bb05940c6fa3c18bf34e192a59474af0fd62c8d8452be8f1581d55eced1

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp312-cp312-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.5-cp312-cp312-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 b9a6385e21c549b4ff75fa8e946bd5b08c8891e8cdf6b1c5a72baf47a3e1338b
MD5 7c44cd607165f2a48d851da2f3560ae8
BLAKE2b-256 7934a752063a9de4cf08c1b200d212b49ee74e84169ce0bcab9f2e9a2f9d2f23

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp312-cp312-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.5-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1b9d8228b3ae334dd3f9bde6bcc81fc432b07da6aacd4b2de8085b40b6f3aa5b
MD5 dbf5d3731f7b5ce30f1a2d8aa3faa7bd
BLAKE2b-256 3f278fca017575cc05e4074848f6c295e1c745596c09b4f8fb8a0d5881c23ec1

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: bonsai-1.5.5-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 87.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2e04a7d7c35c527e92b1835b43063a448c24e01b87b41cd54257ca0a04e24dd6
MD5 8c4f9c2042ab24ecf26bbab9f0dfb6be
BLAKE2b-256 5a01866e886a5b0bd99badff82d2e737e0ad9c1111d7ed73756f4e78d0787f10

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp311-cp311-win32.whl.

File metadata

  • Download URL: bonsai-1.5.5-cp311-cp311-win32.whl
  • Upload date:
  • Size: 81.4 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 77ce92cee2136fe87643e5c5f89f096f384a8a801988416fad78c5fb98e4b746
MD5 a7eca7842e4c8a4eced56bd3f443972a
BLAKE2b-256 7a57dec11e4b1fe6bc29d81c98e3ce6be78d34bb3d87651f5376ff328f5627b9

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp311-cp311-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.5-cp311-cp311-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 8ebaedbc3c344887f70b890d3e38f28509254ce4c5f622f6b2cc96f209de949f
MD5 951325b8de978e8ef501c8c05c319875
BLAKE2b-256 9b4d2e6569bc18dcf7cb1d48b544fb1157eeb881ddfe9492fde13b15a533764f

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp311-cp311-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.5-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 28b49661a8e7e0bdec58048c473154bec4fbe151cb4c91bb3de7c3b9acddcd6e
MD5 da4c4315a0f6bbeb19af7a81fceadc44
BLAKE2b-256 1a30b6875918d483b1884be9391d0402b35386dd1d48e47269513391d28f72a3

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: bonsai-1.5.5-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 87.2 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 404cf47b5da153a6a88fe7a6f34fbbbb14351e742547ea683953fdaee4b22ce3
MD5 c41bfa4d3df87cd5afa6eaec86a922e9
BLAKE2b-256 67d8e414ac99a06f15ca60f0c5ff921eab9278601a3abfae8227ca8c571de23e

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp310-cp310-win32.whl.

File metadata

  • Download URL: bonsai-1.5.5-cp310-cp310-win32.whl
  • Upload date:
  • Size: 81.4 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for bonsai-1.5.5-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 c1aa689417325ef40fd20481b00bbf4478178dcda7dfdff7348a6cb172065f2d
MD5 66ce4481ac358eb1a68923d9b5d7cdad
BLAKE2b-256 364c1a463030fd3f3e5135694c5eab4ca46e7053779f957f8f4aa70ad371757e

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp310-cp310-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.5-cp310-cp310-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 c3c7845a4c7a361108d80c1ac6718a9d37593b8e975635e02bdd02000fc2511d
MD5 b70645dbd695ea69f44442d8f78aff78
BLAKE2b-256 c46dbb86424b36d6be5f6bfd723bc5185cd90bc761b819dda98b03782e931558

See more details on using hashes here.

File details

Details for the file bonsai-1.5.5-cp310-cp310-macosx_14_0_arm64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.5-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 12918054549ef567d792e7b5083bd257f98339b11b5a4f49dd717273c84f55f8
MD5 c8cf78277f47e4938e9cb9fb64b90e33
BLAKE2b-256 5276c39edb35dfaf60603afec0e0e51fc163cc21175cee403fe281bc4d577b9c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page