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)

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

Uploaded Source

Built Distributions

bonsai-1.5.0-cp310-cp310-win_amd64.whl (92.9 kB view details)

Uploaded CPython 3.10 Windows x86-64

bonsai-1.5.0-cp310-cp310-win32.whl (84.6 kB view details)

Uploaded CPython 3.10 Windows x86

bonsai-1.5.0-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.0-cp39-cp39-win_amd64.whl (92.9 kB view details)

Uploaded CPython 3.9 Windows x86-64

bonsai-1.5.0-cp39-cp39-win32.whl (84.6 kB view details)

Uploaded CPython 3.9 Windows x86

bonsai-1.5.0-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.0-cp38-cp38-win_amd64.whl (92.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

bonsai-1.5.0-cp38-cp38-win32.whl (84.5 kB view details)

Uploaded CPython 3.8 Windows x86

bonsai-1.5.0-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.0-cp37-cp37m-macosx_10_15_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7m macOS 10.15+ x86-64

File details

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

File metadata

  • Download URL: bonsai-1.5.0.tar.gz
  • Upload date:
  • Size: 148.3 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.0.tar.gz
Algorithm Hash digest
SHA256 53daf78eba0b4fa5798a0e3274b89a72acc92f649d9f8b84170490c28992ee72
MD5 cdc767d3c30c5da7910e781750a23924
BLAKE2b-256 7c8731ddf1865daf99718afee92da8731490cce9895c7e42948484cefff2fa9d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 92.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.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 cc7d171e7b55d8eef6336acfd969a96f8b197996ef6a93e3ab81d0152bc46ad2
MD5 545db31666a65c20f487522fdc022e11
BLAKE2b-256 d4a71a51c276a7e8b72b4342dc69f3257aa5c8b6587bb755e9235551ed7ff880

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 84.6 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.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 493e99a1a6f69cf9a77cddc4a24dbfef270cfed8c6460e60e749885d0221c11a
MD5 7afa474afabe7a8bd7e8daf4af773087
BLAKE2b-256 6ffdcadf74747cc4aa318cd1e151796e06dd0e8c794d6d6bca754034cfff9a92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.0-cp310-cp310-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 4f45138ff307f2b524d9376ffa6595fc0822ea28f73e4750bfd16d2406fa8d12
MD5 572f38e2b776c922f1e07a2719078225
BLAKE2b-256 4623e6e5f7300c6da3db2a7853600fc258999234862617f3d90fd6dbb4a872ee

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 92.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.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f8f7959f60cf22ec8ff078e9380b879616e59a912c6fb38a6ba2bba08f5192aa
MD5 9deac157de9a41e7036a937fd9564e0a
BLAKE2b-256 c808d99aa87b236aa650d5cb669d91faf052f9a1559093acd14e1a65f40de304

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 84.6 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.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 6436fe5abdd0a7942d5775bcbc7be2c2e6e552d1c8d28b142e03a2e5de389c70
MD5 85ab7ea05bf91d8babdf4b31015cb46c
BLAKE2b-256 60cbc0a181fe81eca9fe525feccd50d7821c6f204f87338d56cd5278664bea69

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.0-cp39-cp39-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 5da576af38d86591c06a9cbbec94c0737a76fb736bfbbae92ac57fd09a646ca1
MD5 0d770ca62b7c204d5f6882424e89e72a
BLAKE2b-256 7c12ebd6846eba5e42929c0e76fe5953437332a1561f222aaffea09731d03a37

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 92.9 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.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 6f977b2f49d0a9cba7e658352abf5547876e5ae3a4bc5fdf6de653d769a8fc9f
MD5 9c7d34713ed0e257eafcd6d0c1f56404
BLAKE2b-256 952585886595bb3ce2f0c0a84cc9098db25b1e47347d800dbe4e471654b54ae1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.5.0-cp38-cp38-win32.whl
  • Upload date:
  • Size: 84.5 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.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 f5813fd13cae324cc04d979714e9cfd4818f7fa662565b132c9566ea9028f92b
MD5 4a3bad79fc9660a1b0b0a3d1eb41006f
BLAKE2b-256 978ff75af8630a89822de5695888c321d12027d6a9fe84e2c2ed74a97b0e7d6e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.0-cp38-cp38-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 52037271df177b1654275795b194c737978e0f147c48b4e309705b751141d919
MD5 257ebecae46888de89b33f82ba160a0a
BLAKE2b-256 f814418048a1b28fb619a84fbbc8141e9f0f92e76480f9d81ac4d91822c68bd6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-1.5.0-cp37-cp37m-macosx_10_15_x86_64.whl
Algorithm Hash digest
SHA256 26f82cab8f79e407f09bb72ee799418c06b13d2445b082cdd1a3cef0798516c3
MD5 0e4efceb2a1fb43d3132e5274cd01277
BLAKE2b-256 a6dffb1e1f52374dc40ba8f7a77ef0f277df141d051a562833396d0653330d22

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