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.7 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.7-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.3.tar.gz (150.8 kB view details)

Uploaded Source

Built Distributions

bonsai-1.5.3-cp312-cp312-win_amd64.whl (87.2 kB view details)

Uploaded CPython 3.12 Windows x86-64

bonsai-1.5.3-cp312-cp312-win32.whl (81.5 kB view details)

Uploaded CPython 3.12 Windows x86

bonsai-1.5.3-cp312-cp312-macosx_14_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.12 macOS 14.0+ ARM64

bonsai-1.5.3-cp312-cp312-macosx_13_0_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.12 macOS 13.0+ x86-64

bonsai-1.5.3-cp311-cp311-win_amd64.whl (86.9 kB view details)

Uploaded CPython 3.11 Windows x86-64

bonsai-1.5.3-cp311-cp311-win32.whl (81.1 kB view details)

Uploaded CPython 3.11 Windows x86

bonsai-1.5.3-cp311-cp311-macosx_14_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.11 macOS 14.0+ ARM64

bonsai-1.5.3-cp311-cp311-macosx_13_0_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.11 macOS 13.0+ x86-64

bonsai-1.5.3-cp310-cp310-win_amd64.whl (86.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

bonsai-1.5.3-cp310-cp310-win32.whl (81.1 kB view details)

Uploaded CPython 3.10 Windows x86

bonsai-1.5.3-cp310-cp310-macosx_14_0_arm64.whl (2.7 MB view details)

Uploaded CPython 3.10 macOS 14.0+ ARM64

bonsai-1.5.3-cp310-cp310-macosx_13_0_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.10 macOS 13.0+ x86-64

bonsai-1.5.3-cp39-cp39-win_amd64.whl (86.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

bonsai-1.5.3-cp39-cp39-win32.whl (81.1 kB view details)

Uploaded CPython 3.9 Windows x86

bonsai-1.5.3-cp39-cp39-macosx_13_0_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.9 macOS 13.0+ x86-64

bonsai-1.5.3-cp38-cp38-macosx_13_0_x86_64.whl (2.4 MB view details)

Uploaded CPython 3.8 macOS 13.0+ x86-64

File details

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

File metadata

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

File hashes

Hashes for bonsai-1.5.3.tar.gz
Algorithm Hash digest
SHA256 c230e79e9c1c8e1e098cf3872feafd23027a6b7c078caa36077155b9641ea9f2
MD5 86b2752431bd4e78f1135cfee6416f9d
BLAKE2b-256 318a641499f3381b8aba24f7d81f46ef9121aaebe6b2963c01d4d97a4d2b36f7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 87.2 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 a584da86e816886e32e23c92470195a62dd6a8500ed9bd3196b0cf770f92ea47
MD5 346000a631f15ff26c8afadc4da3da8e
BLAKE2b-256 ce31ee22d4c4ad1ad9ebdd5169e795aa0b0afcf4c0ef17f63dda2c5c8c9ce32a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.3-cp312-cp312-win32.whl
  • Upload date:
  • Size: 81.5 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.3-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 d63f21ac1176ca4da5e0275c3b4d4013bf0a59acb7ef83dbe13554ab39335a76
MD5 38197c4add80080d0882506801773b93
BLAKE2b-256 347c1e47b3b9ece3b7ea1b45746824aef97c31cd226c29ec29a0d90afc2506b9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.3-cp312-cp312-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 fdf7d70181d21a2a7248d3007654b86257de3fcb144fdb776a2373f9e610f7bd
MD5 376a79857f76f9ccedd83d4b24110940
BLAKE2b-256 231946cdc4931abbe43c7b96d18473c7b9bef64346e2b1c0e72d82454d910047

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.3-cp312-cp312-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 984613838060fda937ed901e8875a0977c1edefc6eb1efd2edb19b7ab149fed6
MD5 333cf774fa8e0ef3459ee4533cd29700
BLAKE2b-256 44b9c8b32e625d45ec5f07cf2e3a3f3d2bfc871759de257021289d1fc68b55fe

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bonsai-1.5.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 df6b6833a1cacc65088efb8a953c05ef57ca98622e0260aadf254598eb398546
MD5 d6c5ff84a74e6b3a568effb45aac0e91
BLAKE2b-256 a1f48de2d6ef2554f19af6d7111ae0e4f1d80fea6070465794e0f53ab6b22cf6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.3-cp311-cp311-win32.whl
  • Upload date:
  • Size: 81.1 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.3-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 338715afeeccfbae6234f17713728e641b5df8ab4dc3760f460b9c246443836f
MD5 c25d5b9aabefc76631e1eb3bf1677a9e
BLAKE2b-256 367fcca545461936a46a77d028e8dd08fe2bc5b6cc5e71b2b1c6f766f8e6558d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.3-cp311-cp311-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 1ba814f8116b724cfdf4091794282ec8ab1d622aa68e27f373d07d6ee25989fd
MD5 03d66f72fcf84f0e75941232079ed0e2
BLAKE2b-256 2084f1a5a20c9addb23f09b47bc874d17804cccdf33bd4b0c0e7bde5dc0e9728

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.3-cp311-cp311-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 082fe4ddeea8a9c6e1d5495b883ba1ddb02dbbc5d819ddc26d036998b36d6da6
MD5 4da266aa9ee4a0a11bb18d30a26c8a3c
BLAKE2b-256 6d360af2b64582818f4d4d062d592f4df5e81dd8fd6e2996682757cde904b659

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bonsai-1.5.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 110d47ec904959d0194218435e12ba2fbd34588e23b1ca7de5ff665f59e986d1
MD5 1592e376a89494d3931e9c5a0173410b
BLAKE2b-256 b0745cb6f3e66074e25ca864b0b083224d22cafa091b27399daa3584c7b064d2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.3-cp310-cp310-win32.whl
  • Upload date:
  • Size: 81.1 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.3-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 471f9f0c4f1829369b40bd3169c3a9c27a60a7c7b273fe198defdc90c77e7c93
MD5 148d4bfa5df1308cc44c98fe3efa3b50
BLAKE2b-256 35af2e9ab3b24fc03878975b759cd45def76b5c9f88de5c9be910a0e434eecb7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.3-cp310-cp310-macosx_14_0_arm64.whl
Algorithm Hash digest
SHA256 bd09b40163e76ccdfdd49b4935a636d68e8d27943cacec7078f7ccaea5b6f7a7
MD5 ce9bbd11c63510601dfe7ed14837d21b
BLAKE2b-256 b9fc44656a3ea39652882491fefc416b0088171e105b153d4fecd3ca9900ce95

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.3-cp310-cp310-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 b75f8f368dfe8dbc5736d4d3d36c6b85ee66d03c5d151c098b0d73f9a2ac7f38
MD5 b3d6b6440c69d2de552d4ad5aba45664
BLAKE2b-256 3b1255a04cee991d1a219f06a4298acd830b992d5da18648e6587bf5f395edda

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bonsai-1.5.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 708dd1b5e18cfc11e05e26dd5320748ebe3a5d727176e7a9def4c6babb170d37
MD5 d571fff5f036f6246f97d36454031f14
BLAKE2b-256 4af652d92a4ffd217decbc6b5b0223933b9bdccbfb556ce939e329cc0c0e2588

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for bonsai-1.5.3-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 07384477ea5f437682b3208bcfd871ebde7e782c8750cebfb18654618aca19a4
MD5 923c2dbec87ee34b2ab34366fd9abc2f
BLAKE2b-256 9374fd4ed67c26ea090729b5ed962f3cf2e874ca60eff22fb1cd6c7c99227c28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.3-cp39-cp39-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 a4080e42cf4e045461bfa0f0db5afd7604dbdfa1bf63e4ca333e0209b9dcd838
MD5 d436e25b6527c7b305898cced833d2d2
BLAKE2b-256 b56bdced904ce071da77aa3d1a4422c8b1b70cc9eadfe26039669c29ed96e3de

See more details on using hashes here.

File details

Details for the file bonsai-1.5.3-cp38-cp38-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.3-cp38-cp38-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 cc7507c36e90029c87b7bcb2371329d13181cb8f9abd8e18f0715b5ae00a683e
MD5 66eba281451036af4fea9b87f60611e1
BLAKE2b-256 5bce2ba41542fa7cb8e4048f8cb36f424592ade76d3ea605a0bdb683903c020c

See more details on using hashes here.

Supported by

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