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.8 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.8-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.4.tar.gz (150.6 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.4-cp313-cp313-win_amd64.whl (87.6 kB view details)

Uploaded CPython 3.13Windows x86-64

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

Uploaded CPython 3.13Windows x86

bonsai-1.5.4-cp313-cp313-macosx_13_0_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.13macOS 13.0+ x86-64

bonsai-1.5.4-cp313-cp313-macosx_11_0_arm64.whl (81.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

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

Uploaded CPython 3.12Windows x86-64

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

Uploaded CPython 3.12Windows x86

bonsai-1.5.4-cp312-cp312-macosx_13_0_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.12macOS 13.0+ x86-64

bonsai-1.5.4-cp312-cp312-macosx_11_0_arm64.whl (81.6 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

bonsai-1.5.4-cp311-cp311-win_amd64.whl (87.3 kB view details)

Uploaded CPython 3.11Windows x86-64

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

Uploaded CPython 3.11Windows x86

bonsai-1.5.4-cp311-cp311-macosx_13_0_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.11macOS 13.0+ x86-64

bonsai-1.5.4-cp311-cp311-macosx_11_0_arm64.whl (81.4 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

bonsai-1.5.4-cp310-cp310-win_amd64.whl (87.3 kB view details)

Uploaded CPython 3.10Windows x86-64

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

Uploaded CPython 3.10Windows x86

bonsai-1.5.4-cp310-cp310-macosx_13_0_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.10macOS 13.0+ x86-64

bonsai-1.5.4-cp310-cp310-macosx_11_0_arm64.whl (81.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

bonsai-1.5.4-cp39-cp39-win_amd64.whl (87.3 kB view details)

Uploaded CPython 3.9Windows x86-64

bonsai-1.5.4-cp39-cp39-win32.whl (81.4 kB view details)

Uploaded CPython 3.9Windows x86

bonsai-1.5.4-cp39-cp39-macosx_13_0_x86_64.whl (2.6 MB view details)

Uploaded CPython 3.9macOS 13.0+ x86-64

File details

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

File metadata

  • Download URL: bonsai-1.5.4.tar.gz
  • Upload date:
  • Size: 150.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4.tar.gz
Algorithm Hash digest
SHA256 52a7fe9a23f57c84dc745a5f2831d11c668734b139a2ff7df04c0ff22676a2c7
MD5 d4858766857d21729590c30db9eb4fb2
BLAKE2b-256 dd4f3fa00051aeb0a0ef9a4c6b628bfcb83f939ba2b1c2c4746d74e5f2029570

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.4-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.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 0893810bcabbeeb86f794bc9d5289676f16b4c6490c12722f2cfbc08137b7ae0
MD5 e0f5ab989b7728dd67a93468edcf9cd6
BLAKE2b-256 ba241b9ffccc3495ae8039a8a003a2fbe11fe06e01f7e9ba33e7869f2f4fd7bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.4-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.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4-cp313-cp313-win32.whl
Algorithm Hash digest
SHA256 c53481b2f60b278dcb0b60b3079969d5e8f441e3f0abc115ec615c88aa5f5c59
MD5 f368b31b6ecc6d021c10e71e5e3e1899
BLAKE2b-256 30d8347cb0a440f90ddd3eedef1da8092a2c283bfea0e2d4bdaac42ccfb15bfd

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp313-cp313-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.4-cp313-cp313-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 4ffe9ceadba12d95f7d944811c6783fb7e1084341ffbcdb8dc44d33ae3857682
MD5 2dee378e5273e6de6166e32816ee9ade
BLAKE2b-256 03fabc82f962534c538764c1420bbe34acc4ace0fc057e17367677da60994de2

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0326d069adc8b0636addb61c1f69f6538c532dc604ff39b9082f2ec6ccc4ff5b
MD5 b7bc18a2870f3468f2c95b8eb1df962f
BLAKE2b-256 a48c58dec7d9bd4a44e65f1bb32b19d82bf5fd05d90da541ba8654abf190876b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.4-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.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 00b84f05c733699deb6d29d97c7749e110bf3a8036d6bf60c9d9ed548ad65b29
MD5 4865182960864b24999f5584d87ce212
BLAKE2b-256 4e804ea332689e0a74b92e68906e3e81ac25bbd750654f6c2ee20ab97a489bb7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.4-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.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 88d59ea66cb0427bb29cbecfd0da94dba1bffbd3f974a77fd68902205eefd761
MD5 5bd8692dff5bf6c17cb20ea06b4af752
BLAKE2b-256 9d9ea092fb6581fdf8ef2560662de4310dc02193a4bdd42d98d7416da6ae7a2e

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp312-cp312-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.4-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 b7f9d5d2e204388014a185e378bda6abe9ff85a56713e7eea81c058173cf57ca
MD5 51af99e8050625921affb8b0745ed49e
BLAKE2b-256 34f142d490513911a29818088ad4238c83a92e9d265606cf562f5c762d7f7996

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 31c84c5fd72750eae96d211180746d1f92a8fd2fae9d65cc98560830b3fbe08d
MD5 653aef97920015e6319d7428ceb02e2d
BLAKE2b-256 dab61babf75ea44b0fc523c17fdea3a9eca53ceecb23b319350ab785943a96b8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.4-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 87.3 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1f99f3c9fdebf8e1b2861a31b845c2427e91a898c7e93e995b950f29c7b7c62e
MD5 1a03643471d45764da0313d3cf939cf2
BLAKE2b-256 f3a7c5bb56129833d49f4cd2d5415e8d4a62aee8dc69ea1d8fd1d2a005151693

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.4-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.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 f0f6a5b60cd27a9813843288f04cb6f2c0357a7105b36a13a8a30ed688cd6078
MD5 e8131a748e009f7b350ecef555615a8e
BLAKE2b-256 920ff12a38931ed78e21e6659292805b87ce846b29b38eff8f4607a6da0556a9

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp311-cp311-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.4-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 58b89576c89aa0869ffb43772da42e889f655d7be6eacad19b90d574c20dabba
MD5 a8b5d46bc96b3ba1896e2e58ce20fdb3
BLAKE2b-256 5bf3873375c7a68e67fc3b216cb2c445ce101a55f0c881f212bb283221e1f8be

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 545518d3e4c98b82fd7a1d8cf34f8d92c730245f039712ac59f85d80bdfea34c
MD5 d4df001b787835df649bc271022d1138
BLAKE2b-256 cbaa9facb4c736dd1d65c48daf7ab8f48b58495235ca164dd9a94ab6471fba73

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.4-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 87.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7575d00300aaec00883e6e2bcc8da1ed980edb6bfcc3542e48954d274438e5a4
MD5 6f05c9778bcb1d09b800c2f81f6d9cd9
BLAKE2b-256 b876f36a979c4c5add46097eb1ef346330f1d32fa394a3511f0a146fd59609b4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.4-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.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 0cd7a28c2cf2aea30d49a0f1cea103d7d6704b60ea0063c8e04e58e8f0adb1b8
MD5 404e3703b660923275ec5e292785ba1d
BLAKE2b-256 6a2fd4e8b0a15ee32c8b66500cd050fe81ed3e892b8346ffcef1c2d9b7befa5b

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp310-cp310-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.4-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 0e7d4dd8477a8892a4d506faac236133e771436fcf5b408a77ba90ed157988c9
MD5 9becd63532b002266efe4677c7e782d8
BLAKE2b-256 5038748d5c0a01e3cebd15cda9e05ce645ef47bde5f1b38642425d6c0821cd48

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4ab91fc2d9353ecd5e021366f22cd5c25206ecf796c87bfb01e57242bbfefb7d
MD5 bf62f8cc4f9a3dc6611174a47ea118b0
BLAKE2b-256 6b5408cd662c42943a9fa7730dbb6b13b5b2ceb6ab7b6a211bfdda603dcb0c6d

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: bonsai-1.5.4-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 87.3 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 da7182a56463304a4925168eea85316f26a90ad8125697dbf81e4f98f6461660
MD5 ce01777505fc47891e3b0166669d24b7
BLAKE2b-256 c028b5d7966a174466b61a3745c207b96b672fceddc765db2302f4536201afb1

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp39-cp39-win32.whl.

File metadata

  • Download URL: bonsai-1.5.4-cp39-cp39-win32.whl
  • Upload date:
  • Size: 81.4 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.4-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 d9b6a5783aba45c0aff71a2464af564add9724f5a3966ea6b170f36fbfbeaeea
MD5 6bf4f997b3e17b726419b422b2574d97
BLAKE2b-256 2162772a4d6572923596c35e453ebdfb128bf8e2c00ff6e3e9098a1fc60359b5

See more details on using hashes here.

File details

Details for the file bonsai-1.5.4-cp39-cp39-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.4-cp39-cp39-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 40423ffdec878ab5bcc74d918290c9c50e8d00bc64f937f51cb3ab24b5b09a4b
MD5 d2b40dda37e3f7a440ae90958b03e013
BLAKE2b-256 9c9aef86f59e74ebb5bd55d189d0b9b07d1a3c9543118792a104d14e2d76c8f8

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