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.6 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.6-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)

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


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

Uploaded Source

Built Distributions

bonsai-1.3.0-cp39-cp39-win_amd64.whl (89.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

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

Uploaded CPython 3.9 Windows x86

bonsai-1.3.0-cp39-cp39-macosx_10_14_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9 macOS 10.14+ x86-64

bonsai-1.3.0-cp38-cp38-win_amd64.whl (89.1 kB view details)

Uploaded CPython 3.8 Windows x86-64

bonsai-1.3.0-cp38-cp38-win32.whl (80.8 kB view details)

Uploaded CPython 3.8 Windows x86

bonsai-1.3.0-cp38-cp38-macosx_10_14_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8 macOS 10.14+ x86-64

bonsai-1.3.0-cp37-cp37m-win_amd64.whl (88.8 kB view details)

Uploaded CPython 3.7m Windows x86-64

bonsai-1.3.0-cp37-cp37m-win32.whl (80.6 kB view details)

Uploaded CPython 3.7m Windows x86

bonsai-1.3.0-cp37-cp37m-macosx_10_14_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7m macOS 10.14+ x86-64

File details

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

File metadata

  • Download URL: bonsai-1.3.0.tar.gz
  • Upload date:
  • Size: 140.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for bonsai-1.3.0.tar.gz
Algorithm Hash digest
SHA256 c74453d35a457f6997db8f1cfc505b7d7ae452b7e7714377176da1e80a2377ff
MD5 8fa386eaabd181de9b3ed26e29a30cc6
BLAKE2b-256 f1b38664e470d99474aed086753f7d3a8b1a49a1b46e5b01b46cfd6076761f10

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.3.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 89.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for bonsai-1.3.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 ee894d2a9612ca86d5edf828efa5b23cf3c5e85d402b636ec1a423d3a8bcc49d
MD5 443a335e67a380bcdc7ceac0cf097020
BLAKE2b-256 ecb71c272f6a5f3bfdeba71eab536944ed04c270f5619ffc8a0a452738636245

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.3.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 80.9 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for bonsai-1.3.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 729292f2462646207f0d8b91941db271020fa18627ac488e83e594be35f8b4bc
MD5 5fc1ed161c02ac527d6fede1caa5815e
BLAKE2b-256 030e88ec8a2dec7d19ff5700d8f7c0dae5e0d83178c0e224270a94c2d674525f

See more details on using hashes here.

File details

Details for the file bonsai-1.3.0-cp39-cp39-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: bonsai-1.3.0-cp39-cp39-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.9, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for bonsai-1.3.0-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8e12a28d86636383ae3045b73d223c3586af78cadfbad14840d25b3f4607cd12
MD5 941b7ab21ff22634db6254a4228486d1
BLAKE2b-256 1ead6185597456c7b828e6d3628d2e94e146e115fe0e42386b504da2dc41bf9b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.3.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 89.1 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for bonsai-1.3.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 e4822c575af68516e3ffb412b037dc3f56b7d211d9f87d90656137f831821cc3
MD5 ecfe8c974f7bf435d9857dc8abf0ec61
BLAKE2b-256 8363ead06f75eb4188ecaf9d324233ac44f39705c654e779a63ef4315b433d66

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.3.0-cp38-cp38-win32.whl
  • Upload date:
  • Size: 80.8 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for bonsai-1.3.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 ec53b8fd31dae4750ba07d5bea7534f23d291c513af6d140bbdda15a91d3f3b0
MD5 3e86bce711e245ac16213f26c9733fc6
BLAKE2b-256 274997ebdb3af75465e88af673967b790d7924da5dce6ca6da987b7dbc70a32d

See more details on using hashes here.

File details

Details for the file bonsai-1.3.0-cp38-cp38-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: bonsai-1.3.0-cp38-cp38-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.8, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for bonsai-1.3.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 8424b4c6c21a85a111c5a36e5af3400446e2b14071318f07578605253fbaf0b5
MD5 6e50712a1aa1a7f9233d5c28b9507649
BLAKE2b-256 40884b172c3155f8c4e22ee5772c47d15f0653dd41ec059766e192de6e093d60

See more details on using hashes here.

File details

Details for the file bonsai-1.3.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: bonsai-1.3.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 88.8 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for bonsai-1.3.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 60c10abed2ae5a2d6ed4b9d1d353f3e0305bc312c8498b11fda20407a416b08f
MD5 fa201f9586a0cc170220a935daf8e59a
BLAKE2b-256 11a7e22a2f936684108611f4a9e50c84d52dee443cf9084ae3f918a0bd427951

See more details on using hashes here.

File details

Details for the file bonsai-1.3.0-cp37-cp37m-win32.whl.

File metadata

  • Download URL: bonsai-1.3.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 80.6 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for bonsai-1.3.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 8cc90c46a78d6365b91d2c1e45721b0b49808b4ed769aa1507ec7cb4f1e4c932
MD5 40036206f8e4859c0ce1cbc9d4251fc9
BLAKE2b-256 9e5eebcbedba896a7edebaa4433190f586b951ac5ce9730f8f3575569ea574e9

See more details on using hashes here.

File details

Details for the file bonsai-1.3.0-cp37-cp37m-macosx_10_14_x86_64.whl.

File metadata

  • Download URL: bonsai-1.3.0-cp37-cp37m-macosx_10_14_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.7m, macOS 10.14+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.6.9

File hashes

Hashes for bonsai-1.3.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 ec1bfcf076113f3f3ffa5309bb000f9f9bfcb9678d7dfda32ce18d7b83469226
MD5 58526fcbee2a34291e964ccb44888059
BLAKE2b-256 a103aeb8da4471de1ec1d1fdc3608704de4bb7493638b29d73ac3d789fd033d9

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