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.4 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.4-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.0.0.tar.gz (120.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

bonsai-1.0.0.win-amd64-py3.7.exe (661.2 kB view details)

Uploaded Source

bonsai-1.0.0.win-amd64-py3.6.exe (661.2 kB view details)

Uploaded Source

bonsai-1.0.0.win-amd64-py3.4.exe (292.2 kB view details)

Uploaded Source

bonsai-1.0.0.win32-py3.7.exe (524.1 kB view details)

Uploaded Source

bonsai-1.0.0.win32-py3.6.exe (524.1 kB view details)

Uploaded Source

bonsai-1.0.0.win32-py3.4.exe (256.0 kB view details)

Uploaded Source

bonsai-1.0.0-cp37-cp37m-win_amd64.whl (69.6 kB view details)

Uploaded CPython 3.7mWindows x86-64

bonsai-1.0.0-cp37-cp37m-win32.whl (62.1 kB view details)

Uploaded CPython 3.7mWindows x86

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

Uploaded CPython 3.7mmacOS 10.13+ x86-64

bonsai-1.0.0-cp36-cp36m-win_amd64.whl (69.6 kB view details)

Uploaded CPython 3.6mWindows x86-64

bonsai-1.0.0-cp36-cp36m-win32.whl (62.1 kB view details)

Uploaded CPython 3.6mWindows x86

bonsai-1.0.0-cp34-cp34m-win_amd64.whl (66.0 kB view details)

Uploaded CPython 3.4mWindows x86-64

bonsai-1.0.0-cp34-cp34m-win32.whl (61.0 kB view details)

Uploaded CPython 3.4mWindows x86

File details

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

File metadata

  • Download URL: bonsai-1.0.0.tar.gz
  • Upload date:
  • Size: 120.3 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.0.0.tar.gz
Algorithm Hash digest
SHA256 a6d4edcf400654e5d79389a2d1335b6e3bcf69c94769214905d9eb0b5f124f56
MD5 2e3fc22af2286eadc63bca20f4b18f83
BLAKE2b-256 b1bc4de77514711819ea3549333f1d554179205465880594b32289f17b26018e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.0.0.win-amd64-py3.7.exe
  • Upload date:
  • Size: 661.2 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.0.0.win-amd64-py3.7.exe
Algorithm Hash digest
SHA256 17e4d4ea50364bfc84ff51316550fc235d83518ec98c5393e432a5222016a1e4
MD5 67414d3f1c8bded0b06cfac6a36b9038
BLAKE2b-256 27203299112e54fdd83005a4546da3600c00a2837fbff95def5bb0d224f59a4b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.0.0.win-amd64-py3.6.exe
  • Upload date:
  • Size: 661.2 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.0.0.win-amd64-py3.6.exe
Algorithm Hash digest
SHA256 9c2baf649dedeaa3ae5e529f4d729b0d855b0399a247b2f2bcc01963683c1788
MD5 353a02cab0cbb7a513a749bfe2614417
BLAKE2b-256 ebcadf48a3ae1598b9b11d1a52ffb136f4ecd00d9f2a7994c7829081815866e0

See more details on using hashes here.

File details

Details for the file bonsai-1.0.0.win-amd64-py3.4.exe.

File metadata

  • Download URL: bonsai-1.0.0.win-amd64-py3.4.exe
  • Upload date:
  • Size: 292.2 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.0.0.win-amd64-py3.4.exe
Algorithm Hash digest
SHA256 d831f56782c4761e03654e9e7512b346df252cf6d36c5d6a42a025d2ed4df914
MD5 a16162feaf913a33cb1f58f91af17585
BLAKE2b-256 3b9bade1d32b1e52fd02164976653f47d20bced075291b3cdc1f9179799a6652

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.0.0.win32-py3.7.exe
  • Upload date:
  • Size: 524.1 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.0.0.win32-py3.7.exe
Algorithm Hash digest
SHA256 824bfa6b78b3727c230b8c9060572b6f3850ca885bc366fc727df3b80ea5a11a
MD5 317c72f0de71dafc59fad2c7b79978ee
BLAKE2b-256 db4bce6e7de5565689c46affc9128d47dbda88cbb90e0d0452e76da7a6d9d7c9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.0.0.win32-py3.6.exe
  • Upload date:
  • Size: 524.1 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.0.0.win32-py3.6.exe
Algorithm Hash digest
SHA256 54a63796875b80fbd3827467cc0c15a131aebcf99152590909ce3612ba1d05b9
MD5 a2dad9966e9a2387780d0d7f1ae7b34a
BLAKE2b-256 cd598b94bb53f7ac4129456d550bc61a61ed005d26e7551c198c10591b7f5165

See more details on using hashes here.

File details

Details for the file bonsai-1.0.0.win32-py3.4.exe.

File metadata

  • Download URL: bonsai-1.0.0.win32-py3.4.exe
  • Upload date:
  • Size: 256.0 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.0.0.win32-py3.4.exe
Algorithm Hash digest
SHA256 59f28b4ce3cb3daacc2b02b809f2329d0794b95113a1b91f2fb1dc1c03d893b6
MD5 df3ed34e313f71547ddec906d01ee579
BLAKE2b-256 fa700f9a1a24a185f44b270775ea94a2524dda29bbae09237f5ddf1b56f56246

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.0.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 69.6 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.0.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 b0f86f1297adda152f78e0f3765e0c3c8c073659f99f44c30d85b5f36b8b58c4
MD5 a4a3f43880a67f1ef247d06393d8d11d
BLAKE2b-256 a969ab0aef88bbe55cee38e99c8e51479b42adaa987c6611635b339b2f6f5be5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.0.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 62.1 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.0.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 3ef82db36a70e13f54fd72bafef10aeaf960e612444548a62f621c03ad32255c
MD5 d094f3c4354df21e097ec79437e7a317
BLAKE2b-256 77da0f88d204451eb9002f8980db09d98a8b7b15f472aed6c98cba40b6c3e4e1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.0.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.0.0-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 29ecc043d33323a36b91595756cc7aaa2105518ef2b823dc3a1f2aa304a9556b
MD5 484d8e40a0883bb7659d3ade101a68c1
BLAKE2b-256 57e42b3467cf0ea1269cc3d58c531f7c6a5ff8432650768cc0f84d14757c5ca1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.0.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 69.6 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.0.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 5f70077f306b7eb28e139c2fb2033685f402ff8169d12b16415cfa32ab159017
MD5 c9e5f6df2a41181fbffe3aac8f2f9422
BLAKE2b-256 10a855312f463a5cd6caeb5eac8843b775e0c4064aaf98ddd7bb673eaf25e7f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bonsai-1.0.0-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 62.1 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.0.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 1975ecce2a41f1c054dc9d3134b1c20b96f3ef7488ce57dff519412e949f0130
MD5 4b28689fcad63bb25316ac17f078e523
BLAKE2b-256 e7da45c9ef0370941ea1e0a5474b022b524a791a6011157bc087888845b3cdcc

See more details on using hashes here.

File details

Details for the file bonsai-1.0.0-cp34-cp34m-win_amd64.whl.

File metadata

  • Download URL: bonsai-1.0.0-cp34-cp34m-win_amd64.whl
  • Upload date:
  • Size: 66.0 kB
  • Tags: CPython 3.4m, 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.0.0-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 6a9a49f77aa4a0331faed53424cc0c549a7b661861577b36d73ee5a278841663
MD5 3d56a2cd4480a096571d1e86f6a75e5f
BLAKE2b-256 e12ce24a8b6f611a076967f9bc6c2b54535c11dcd68271666794c66532cf421d

See more details on using hashes here.

File details

Details for the file bonsai-1.0.0-cp34-cp34m-win32.whl.

File metadata

  • Download URL: bonsai-1.0.0-cp34-cp34m-win32.whl
  • Upload date:
  • Size: 61.0 kB
  • Tags: CPython 3.4m, 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.0.0-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 74f997c172b8ac5a8209eb0da886389acc0473128268e95cdc2403ff7925def4
MD5 41f554beda4e51481eb7a2e23351de00
BLAKE2b-256 4c4550e35298b197f6b8eb087d9a72681adc1898238e62d162e8cd52d65fb1ac

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page