Skip to main content

Python 3 module for accessing LDAP directory servers.

Project description

PyPI Version Travis CI Build 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.5 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.5-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 (on Python 3.5 or newer):

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

Currently, you can read the changelog here.

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

Uploaded Source

Built Distributions

bonsai-1.1.0.win-amd64-py3.7.exe (665.9 kB view details)

Uploaded Source

bonsai-1.1.0.win-amd64-py3.6.exe (665.9 kB view details)

Uploaded Source

bonsai-1.1.0.win32-py3.7.exe (528.8 kB view details)

Uploaded Source

bonsai-1.1.0.win32-py3.6.exe (528.8 kB view details)

Uploaded Source

bonsai-1.1.0-cp37-cp37m-win_amd64.whl (74.3 kB view details)

Uploaded CPython 3.7m Windows x86-64

bonsai-1.1.0-cp37-cp37m-win32.whl (66.7 kB view details)

Uploaded CPython 3.7m Windows x86

bonsai-1.1.0-cp37-cp37m-macosx_10_13_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.7m macOS 10.13+ x86-64

bonsai-1.1.0-cp36-cp36m-win_amd64.whl (74.2 kB view details)

Uploaded CPython 3.6m Windows x86-64

bonsai-1.1.0-cp36-cp36m-win32.whl (66.7 kB view details)

Uploaded CPython 3.6m Windows x86

File details

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

File metadata

  • Download URL: bonsai-1.1.0.tar.gz
  • Upload date:
  • Size: 123.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for bonsai-1.1.0.tar.gz
Algorithm Hash digest
SHA256 cf4da3b78b58e0437ead94f653004cdf78d29f219d6d87c9a2cbe512f3a2df5d
MD5 d29964da2fadc5542fd5813d1860d2e0
BLAKE2b-256 0e4f6b73b2b993df1bc4de4061c3698e14e72c167001bac4537ea2e309bc6044

See more details on using hashes here.

File details

Details for the file bonsai-1.1.0.win-amd64-py3.7.exe.

File metadata

  • Download URL: bonsai-1.1.0.win-amd64-py3.7.exe
  • Upload date:
  • Size: 665.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for bonsai-1.1.0.win-amd64-py3.7.exe
Algorithm Hash digest
SHA256 1400386f5adc1ab3af02696b69f37c8eecfd89d1d97faf2cf62f7649ef10d8cc
MD5 f558a67f133b2e3945cebe9345128708
BLAKE2b-256 9af76710b5c5af63b4425fcbd6b129ce528373bf1df52af0299d20f934f275df

See more details on using hashes here.

File details

Details for the file bonsai-1.1.0.win-amd64-py3.6.exe.

File metadata

  • Download URL: bonsai-1.1.0.win-amd64-py3.6.exe
  • Upload date:
  • Size: 665.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for bonsai-1.1.0.win-amd64-py3.6.exe
Algorithm Hash digest
SHA256 b841f3dcb4264b42a7ad15763bd3d5450ef05f456f5192eebdde9b7910be893b
MD5 e79004c14d5ede6aed0361788b98f141
BLAKE2b-256 8a3c0f43a28c4594cb6e3b3ade9fd652c873c3af340fb4162a326b36a1d2d414

See more details on using hashes here.

File details

Details for the file bonsai-1.1.0.win32-py3.7.exe.

File metadata

  • Download URL: bonsai-1.1.0.win32-py3.7.exe
  • Upload date:
  • Size: 528.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for bonsai-1.1.0.win32-py3.7.exe
Algorithm Hash digest
SHA256 a0ac30f37f52220ea0b53c82d53936417e6dd6f9760468c23c9c20522b827205
MD5 6c6a6ab6187e5bf7bc6017a829925e7f
BLAKE2b-256 2e9698a618fc4da54d0c891a3d75eee609ce13eeed0f89557a5e292bc9970536

See more details on using hashes here.

File details

Details for the file bonsai-1.1.0.win32-py3.6.exe.

File metadata

  • Download URL: bonsai-1.1.0.win32-py3.6.exe
  • Upload date:
  • Size: 528.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for bonsai-1.1.0.win32-py3.6.exe
Algorithm Hash digest
SHA256 6572f10c40f5ab9b85e3afaa4d49c7bf46538e9880909fc7b0688eb6cdb7f333
MD5 f868cfd2b1ffc10652d5479b9b0620e2
BLAKE2b-256 f2cc0c6629460c8f096317c176467cf8f6ead5bd92008bb0b6a76c5694a16b9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.1.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 74.3 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for bonsai-1.1.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 e96e6a6bed6a72041dcfe8e2b1490557a78f5ba7c0d7f43b46823abbfa9853ad
MD5 5f1cbc3925ef433e3c6504e5fbefdeb7
BLAKE2b-256 1102ba81f30a4a9f50e4d401357dd279d089c1664621638586664b5ec8607495

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.1.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 66.7 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for bonsai-1.1.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 ed8d6d86baa9a2cc48936e307db1b7b259366e1efc53c512c8aea4415aa96f83
MD5 2cc88feb0b55c3945738ab54b2b790d8
BLAKE2b-256 99fbe80de00a309b57f13f296cc5bde34002d8706d47034c70da944f52848df2

See more details on using hashes here.

File details

Details for the file bonsai-1.1.0-cp37-cp37m-macosx_10_13_x86_64.whl.

File metadata

  • Download URL: bonsai-1.1.0-cp37-cp37m-macosx_10_13_x86_64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.7m, macOS 10.13+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for bonsai-1.1.0-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 df8ef71c206363e9a9668caa8fa56dcd4d9d1d024acac510288f572b4d83251b
MD5 0bf0e5d152615512feda9d4584b8a747
BLAKE2b-256 a4849b4b68d47147a952bfdf53fba424528f99d8ac25b52fa911e28619a0a524

See more details on using hashes here.

File details

Details for the file bonsai-1.1.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: bonsai-1.1.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 74.2 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for bonsai-1.1.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 2a72fdd0574ae111b63959347622512cbf8eab867d813024386cffefc90bb6f2
MD5 89e9469a3a99009bb05cb252e0346c7b
BLAKE2b-256 e838193fde3cd11e3edb8749aaff87f3142b0f709cba0055b1e414afdc664c9a

See more details on using hashes here.

File details

Details for the file bonsai-1.1.0-cp36-cp36m-win32.whl.

File metadata

  • Download URL: bonsai-1.1.0-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 66.7 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.3

File hashes

Hashes for bonsai-1.1.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 638b221ff0034d74c84896fa49a13620a93e72efb9b6f373b46ecda073c85b34
MD5 0deb43fe4285cb79f23b38814b8a5b96
BLAKE2b-256 43dc0dc93d47cd073ac3f9571d5566ba4754987918d077777633d11af01689ba

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