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

Uploaded Source

Built Distributions

bonsai-1.4.0-cp310-cp310-win_amd64.whl (91.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

bonsai-1.4.0-cp310-cp310-win32.whl (82.8 kB view details)

Uploaded CPython 3.10 Windows x86

bonsai-1.4.0-cp310-cp310-macosx_10_15_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10 macOS 10.15+ x86-64

bonsai-1.4.0-cp39-cp39-win_amd64.whl (91.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

bonsai-1.4.0-cp39-cp39-win32.whl (82.8 kB view details)

Uploaded CPython 3.9 Windows x86

bonsai-1.4.0-cp39-cp39-macosx_10_15_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9 macOS 10.15+ x86-64

bonsai-1.4.0-cp38-cp38-win_amd64.whl (91.0 kB view details)

Uploaded CPython 3.8 Windows x86-64

bonsai-1.4.0-cp38-cp38-win32.whl (82.7 kB view details)

Uploaded CPython 3.8 Windows x86

bonsai-1.4.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.4.0-cp37-cp37m-win_amd64.whl (90.7 kB view details)

Uploaded CPython 3.7m Windows x86-64

bonsai-1.4.0-cp37-cp37m-win32.whl (82.6 kB view details)

Uploaded CPython 3.7m Windows x86

bonsai-1.4.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.4.0.tar.gz.

File metadata

  • Download URL: bonsai-1.4.0.tar.gz
  • Upload date:
  • Size: 143.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0.tar.gz
Algorithm Hash digest
SHA256 0f292f1ced14ed6118aa679978b1981272c78545af04579dafc2dae2b3b9e0d9
MD5 ac8f11b1edde5a480aa5886c4e5db0af
BLAKE2b-256 eb26046b136e88d19ec5ecf00bbebfc38d3a61f5036cbafae03594beecd57a3b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 91.1 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 71a7ab8260cf9719626f3f9a77fb29b25284c20b72ac2fb4adfd283f2ab366ef
MD5 99549bfaf6b8c204202de02c7b4dd8e9
BLAKE2b-256 9d7661a8102ab5f4b94e6f03f1789b2baeed91ab650af402693cee36e3e81a84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 82.8 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 1e10b1ea5bfc27c4f54eb4360cfceebd75b9a9ba8fe73e42a6106bf14446d003
MD5 e06fb2c08b817a4ab9de1d06d05ebc8c
BLAKE2b-256 92303fcc5b80568fc5a235fece9ce5370c583774c10f1f11233df7a70d4bbb6b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.0-cp310-cp310-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.10, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 8088623294d935bdb96c5e5fd532942a58700d01ab44e6dab4c5a7cc1600182d
MD5 9f9ede784a3928b9fe9b3e34a5e11fe7
BLAKE2b-256 4fa207a53da8bd01ad28e7cd4319c57d48a1ce562d713c7c822d53cf7e7713e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 91.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3a74608913360eb92bc703f726cf416e56922d2b0093d2530ca4c13f879746aa
MD5 90303040b401ca8793c8ef7385933043
BLAKE2b-256 ea2530fe1fda75630481825e1e0785c04d5cb09c57c672e4e56de77c5f18b1a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 82.8 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 7ced3e2cb3a68cd97ab6c7558fdcb1ff8bf7267d3128b360e589e2b75dc7f731
MD5 d60daa696a6781a63a260532d8e748e6
BLAKE2b-256 a96c2b82d197911330e222c787dad9a7a7e6f1bf89e206cec9888c3e138c2b87

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.0-cp39-cp39-macosx_10_15_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.9, macOS 10.15+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 462553ec59137d08f23861fea5ba6759d44175e8b91a54c60c11543e925ce324
MD5 2eb763837345203b639e2d58508b006d
BLAKE2b-256 5168e88ef75dc2f33dc9fec619e158646ab0908f45eb07c451a95628c17d4c86

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 91.0 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 adb89e38f8729c0454818a8112e9fc6502ce0cfb71457fce932336a8bb6680d8
MD5 38faf287c377ab84644c402156a10c56
BLAKE2b-256 ca0241b86a7d7de4777152714b2050cb8213f77f7bab6dc7fe8077645244bf16

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.0-cp38-cp38-win32.whl
  • Upload date:
  • Size: 82.7 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 f9ddcf138b8b9eb162954de257a10050f40d3a41630fcf52bf254309e30d9501
MD5 85ece2dcb93a02b59e14afd40390d372
BLAKE2b-256 30b1bf4d98a287e0c163dd1c5aef20a8a137a36b8cfcbdc55f4189db3299d817

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.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.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 7aeada00b94ac72109a1751bfe551ed57dfe6d6bb224b69a5ecc12b9b0a8c381
MD5 50272a051f44bdca219ed7adf9f0f427
BLAKE2b-256 2eae89e7271972f4a2cc8cf1259a381be11299ceaa4a380b94459a9a0f0904ce

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 90.7 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 4fb0c7a536c8fa1faab8e9c9febee74383ef835f82b23fbf916e7e4b9ac13586
MD5 53f04fc3ff512e7c27e9991567f16d77
BLAKE2b-256 3b3a58eca7e369d40cad854ea5477ae0774523d2f4de90dac8680356a1210de8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 82.6 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 39c0cad9ebf299dfa4dcd36191c5dc33e1b51f5e3af754327c6bb5d59ee0591c
MD5 4dc4c4ec76a7601a424e8ca63b39d130
BLAKE2b-256 17dff4ac1974ba5c671745748169976ad0a8dd6aaec8c2bff31b206ea5f0f4e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.4.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.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.22.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for bonsai-1.4.0-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm Hash digest
SHA256 ed8385494da7b5a55160511ce57be42ca035e91b3067c4a07807d7a28a0f22a7
MD5 4c2d02cbb7bc170b985c3d8e31414687
BLAKE2b-256 4b42d9412b72e91d9455c440e7c749adbef7b80ad1919a4a590c1da29ec55365

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