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

Uploaded Source

Built Distributions

bonsai-1.5.2-cp312-cp312-win_amd64.whl (87.1 kB view details)

Uploaded CPython 3.12 Windows x86-64

bonsai-1.5.2-cp312-cp312-win32.whl (81.4 kB view details)

Uploaded CPython 3.12 Windows x86

bonsai-1.5.2-cp312-cp312-macosx_10_9_universal2.whl (2.3 MB view details)

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

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

Uploaded CPython 3.11 Windows x86-64

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

Uploaded CPython 3.11 Windows x86

bonsai-1.5.2-cp311-cp311-macosx_10_9_universal2.whl (2.3 MB view details)

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

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

Uploaded CPython 3.10 Windows x86-64

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

Uploaded CPython 3.10 Windows x86

bonsai-1.5.2-cp310-cp310-macosx_11_0_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

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

Uploaded CPython 3.9 Windows x86-64

bonsai-1.5.2-cp39-cp39-win32.whl (81.0 kB view details)

Uploaded CPython 3.9 Windows x86

bonsai-1.5.2-cp39-cp39-macosx_11_0_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

bonsai-1.5.2-cp38-cp38-macosx_11_0_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.8 macOS 11.0+ x86-64

File details

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

File metadata

  • Download URL: bonsai-1.5.2.tar.gz
  • Upload date:
  • Size: 149.9 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.2.tar.gz
Algorithm Hash digest
SHA256 8d6ba21fcbbd4309dcffdba723247aa3dc6a971474b941edcfa3ce1c0ed3ff41
MD5 9b8fa0663bb530a58b2129df35b40981
BLAKE2b-256 baa50e3aeedfe4a8f183965e0fe47024c6855ef7bd95912df9c1093351425a03

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 87.1 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.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 428c503d6d7895f050d55438648572172020c0b3fe0ee7dc524ce6eb046b3a12
MD5 75fa8a0ec4ef02e4f4c9a6a72e203210
BLAKE2b-256 0b392892c9b4eeb23337e165553fc756f77603419c8ebf1eada4cf99cd2e3ed0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.2-cp312-cp312-win32.whl
  • Upload date:
  • Size: 81.4 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.2-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 ee7cb0269fc887cf60f6fd27dba019a88bfaf1104219e6b23e1bb6b01498dfb6
MD5 b26fa182d01926f2cfb8f82c23084795
BLAKE2b-256 96b50ec025d266902ba4b0b86622bb7127d0ea5e6ca9db485abbffa0bac8f9ea

See more details on using hashes here.

File details

Details for the file bonsai-1.5.2-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for bonsai-1.5.2-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 24d3ee90938eaea96c21e176202d8dad2ee0fd2119eaae40f3349fcd69e98682
MD5 b822c48c68749fe6d25ba89f5561a432
BLAKE2b-256 a52df6d8aa846f63f439de6484432d7f2798bdd4538e81e53b96d4685be05be8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.2-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.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 78e75ce4298041516e2a67c47c8332089fc7e0e19a46840b5dd9c0068cfd8abd
MD5 9f3a8972a36be3dae5ccdcafaa5b6db5
BLAKE2b-256 d1be96ecacd5169308ef5e727a5747a72ef48e0d6526d0a6f50c6cb976ce884c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.2-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.2-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 3ebc465dcafd0d739e258a201c5043f5ac2380770c3a0ab8b7412222002bf4a4
MD5 3e70390fa7c10b64dc3de2a500f8abfb
BLAKE2b-256 2f46a3a032dfa9d1ad31ccf3ab6853343449b228beaad87e3505a2576ec46198

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.2-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 b40510c6d3c338ba805eaf6d07aebffc138d1beca31dc750eb2b6127f99296b1
MD5 b79c8a64a6af3c52eb60b1328f329c0a
BLAKE2b-256 b6f48ae3985ba818084847c3d296594be5665b9940c083225db57d5925f37368

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.2-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.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 3ce093a6a188fcba50c1107f86f30c2ce3dc1f080f1d009b54d160c3b620353b
MD5 b809b02becbc633bad74462553ab4042
BLAKE2b-256 82331da1d730f05e7fe753dd57f596853525aef34fd2b1e009b6da34e2c6c57f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.2-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.2-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 c82320679bdaaccf1939eaf4326a4721e80ca099f5bd790c3eb546f37f157e7b
MD5 f0b906b55b0a64677aeb497354a0ff86
BLAKE2b-256 0e4810dbd30873a4df36ea339f6624b85fbed9764f6aa6b722ed4a55de26886c

See more details on using hashes here.

File details

Details for the file bonsai-1.5.2-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.2-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 aaa4ed441cb6562b587f524a7ca6898ef41c6c4d2600fab5cc91af8fbd2d02e8
MD5 7302b1eaaaa8eb73f003f89d69f7c0ac
BLAKE2b-256 0488fb410fd85d65158ab9b98645bdf60597526be886579897b459feb925dc64

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.2-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.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 763a0e1d59f31c530599caf1158cf370a5c1b8e41d71a5e8000c552913b35697
MD5 408ad08ed903011af56c7127eaef96c3
BLAKE2b-256 adb0300d03302594d281336f1f7f226c91395e8fb5650aaf3c7c7b24ddabf0b6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.2-cp39-cp39-win32.whl
  • Upload date:
  • Size: 81.0 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.2-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 87765b3971bd63a88dd597f471992767d69d523c4759f372cbf5034767fbb2c6
MD5 fbd3aae75f3d58e1d794f61df1a04162
BLAKE2b-256 b9de87031103e94d0f7077e1f8c039ed03ccd534c286a9a8b4e49ce3a507c555

See more details on using hashes here.

File details

Details for the file bonsai-1.5.2-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.2-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 3c75286ae61f243c9a13855f47734bff1b99736a9350b19350083cd5c9ca4ed8
MD5 0cecbd180a62d759d3444f7a478a524e
BLAKE2b-256 985a4104b9425bee3f9fde56112d5c72decfee79bec329db4d3f6598dffc53cb

See more details on using hashes here.

File details

Details for the file bonsai-1.5.2-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-1.5.2-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 bccd9bbd5ba6722444a01557f75b031c455d35c5d0307bceebdad99a35ed1473
MD5 fa8e1eafd02e32e020f8dda553b71b9d
BLAKE2b-256 c320055dc9d91ffa97ff67ba782ccd6fa4a8a5b222dae1c3c603750ab485ae0d

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