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

Uploaded Source

Built Distributions

bonsai-1.5.1-cp311-cp311-win_amd64.whl (86.8 kB view details)

Uploaded CPython 3.11 Windows x86-64

bonsai-1.5.1-cp311-cp311-win32.whl (80.9 kB view details)

Uploaded CPython 3.11 Windows x86

bonsai-1.5.1-cp311-cp311-macosx_10_9_universal2.whl (1.7 MB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

bonsai-1.5.1-cp310-cp310-win_amd64.whl (86.8 kB view details)

Uploaded CPython 3.10 Windows x86-64

bonsai-1.5.1-cp310-cp310-win32.whl (80.9 kB view details)

Uploaded CPython 3.10 Windows x86

bonsai-1.5.1-cp310-cp310-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

bonsai-1.5.1-cp39-cp39-win_amd64.whl (86.8 kB view details)

Uploaded CPython 3.9 Windows x86-64

bonsai-1.5.1-cp39-cp39-win32.whl (80.9 kB view details)

Uploaded CPython 3.9 Windows x86

bonsai-1.5.1-cp39-cp39-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

bonsai-1.5.1-cp38-cp38-win_amd64.whl (86.8 kB view details)

Uploaded CPython 3.8 Windows x86-64

bonsai-1.5.1-cp38-cp38-win32.whl (80.9 kB view details)

Uploaded CPython 3.8 Windows x86

bonsai-1.5.1-cp38-cp38-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.8 macOS 10.15+ x86-64

bonsai-1.5.1-cp37-cp37m-macosx_10_15_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.7m macOS 10.15+ x86-64

File details

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

File metadata

  • Download URL: bonsai-1.5.1.tar.gz
  • Upload date:
  • Size: 149.6 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.1.tar.gz
Algorithm Hash digest
SHA256 101b0d166349bdcbf764a8139fd06b85b5524b4425e3f2bd6c2381f90369f735
MD5 1dd7821d29a5606ab0fac8bd39ed564d
BLAKE2b-256 82a8e743e4c8d168a5b8216476cc0a7b8d8b9143427d7f1807aa7d7cde3eaa34

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 86.8 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.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 5ff980752304d59e77b7b86275c9a28dd39b597780f720bfb32c57d0134f9217
MD5 3c46ebdb03f1441b667a1d3e09b334cf
BLAKE2b-256 7e12a5048f0531c36f65b4c1cc491bb5e2d58a384f0176bde2eb37f9e509f61a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.1-cp311-cp311-win32.whl
  • Upload date:
  • Size: 80.9 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.1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 81c85f2208d7ffe80855c8096dd17b99f52e61f0fb4e3e72357bf4e5af092929
MD5 69540cc149c96adf1a6972cd5aaa60a8
BLAKE2b-256 aeae879c1985082b63075c2536d05628c02a2ac28b6f7ea73b797626c98fc860

See more details on using hashes here.

File details

Details for the file bonsai-1.5.1-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for bonsai-1.5.1-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 e960cadc3ef96622a7df8297948e9fd7284708805747f10f52ef11e52f06b63d
MD5 23387d2e099e2c96aac5e35582df3d86
BLAKE2b-256 0d758590691c355fca9d5867cfc8c0420b3d5caf800071c4756ab4c255077473

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 86.8 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.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 62d509e047adcdb06736896fd3f24cb3f334785664e60a0d66dc428ea415a3a1
MD5 33a36b336e230053e0f704e3cffd8bdf
BLAKE2b-256 7d5520bc6b20efd6bf76b05af9019cbc15d86bf2801a57d0c82543db54181751

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.1-cp310-cp310-win32.whl
  • Upload date:
  • Size: 80.9 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.1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 7919257957ec72d16d3375676bbc20232f15a1c12d909623a971a69a5ea553ba
MD5 f7dd0d8353cd44e7f8d51e5653d9bf3e
BLAKE2b-256 85edc2fc06a5a84a369aeaf8bc9f80254e7c7da2f78f0eda0d4b325766e17338

See more details on using hashes here.

File details

Details for the file bonsai-1.5.1-cp310-cp310-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.1-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 1fa0d5e8ca5ea5ca6af88d515037e9de32430ca65cdd3d9ffd3caabd5d42da71
MD5 207daa4d6e87a37a23d98abbec7a9890
BLAKE2b-256 9589839b47a7d8028a720080e149764b22d4aa72b900309a4dee543a6b7c47f1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 86.8 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.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 e599f5dc11e38a143edb451e28fdd448d18b5ecae4a74addf583d602a8f9057a
MD5 1af1c5a5d46ae95ab799a95cd01ba091
BLAKE2b-256 94eabe4763b525e94f896a50f176db8fdd5eb9b476bc8eed8c562991a588911f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.1-cp39-cp39-win32.whl
  • Upload date:
  • Size: 80.9 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.1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 8a8f3615bc5b6546b28731514c3276c3e2c725f6a42276d0005bf26f73d188fc
MD5 7f62ba51d2bcd18b1d3caec813e12c26
BLAKE2b-256 6dc5a6d5f28ede32fcda171861054358dc718c87d1f270af45041b904c3079c9

See more details on using hashes here.

File details

Details for the file bonsai-1.5.1-cp39-cp39-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.1-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 8b1ed74406d7b839307067a1006699bdbd1e23fed3f6440f71e8bc4b52c3e64a
MD5 03f25011830973ed5d4655cf52260209
BLAKE2b-256 c04602ba1fcc6d6cbef8d9327ad0100d09c19f4abb29cfe2a3019a8d80332a5e

See more details on using hashes here.

File details

Details for the file bonsai-1.5.1-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: bonsai-1.5.1-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 86.8 kB
  • Tags: CPython 3.8, 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.1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 a2b0aaa51293167ab2d82acee904feeeb25f0668087c7101906169538dfaa494
MD5 07c663cd6537a8405a945954c9133190
BLAKE2b-256 ed24a5b8d24d1328f0d1fca1fb2fcc4b5dae55381502764dd134e496dba59f46

See more details on using hashes here.

File details

Details for the file bonsai-1.5.1-cp38-cp38-win32.whl.

File metadata

  • Download URL: bonsai-1.5.1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 80.9 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for bonsai-1.5.1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 03f264278f2d02346bf3603a836e918c193e63831d306569304aed3f854fce7d
MD5 678b832d7f1aa27fd95533842289fde3
BLAKE2b-256 8c21167a52dc39ece1ceeed34c5b9d22d73f291ce1c44e365bcd9692ee560ccf

See more details on using hashes here.

File details

Details for the file bonsai-1.5.1-cp38-cp38-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.1-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 97e489da7e2958e69d3e617e25f92a688d9bebc2308ea06a053f66d4893bc7a9
MD5 d207a889346398b0ba78c2967a832685
BLAKE2b-256 4417dbc4f11e3bc3758d64d878f30b6a10566d76d41cf0fa711fdca143f2f3b0

See more details on using hashes here.

File details

Details for the file bonsai-1.5.1-cp37-cp37m-macosx_10_15_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.1-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 72d435264229cb9adf74c8a0b88dbdd84805904617387582b6741adf95555fef
MD5 54096405f90103aa8c3dd86bd4ad2152
BLAKE2b-256 9bd5b9bc0cb7ab1eca3513bb4b21623033b8c258ae92c4e84f9858299add8bdb

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