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", ("cn=admin,dc=bonsai,dc=test", "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", ("admin", "secret", None, None))
    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-0.9.1.tar.gz (108.0 kB view details)

Uploaded Source

Built Distributions

bonsai-0.9.1-cp36-cp36m-win_amd64.whl (65.9 kB view details)

Uploaded CPython 3.6m Windows x86-64

bonsai-0.9.1-cp36-cp36m-win32.whl (58.5 kB view details)

Uploaded CPython 3.6m Windows x86

bonsai-0.9.1-cp36-cp36m-macosx_10_12_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.6m macOS 10.12+ x86-64

bonsai-0.9.1-cp35-cp35m-win_amd64.whl (68.0 kB view details)

Uploaded CPython 3.5m Windows x86-64

bonsai-0.9.1-cp35-cp35m-win32.whl (60.7 kB view details)

Uploaded CPython 3.5m Windows x86

bonsai-0.9.1-cp34-cp34m-win_amd64.whl (62.4 kB view details)

Uploaded CPython 3.4m Windows x86-64

bonsai-0.9.1-cp34-cp34m-win32.whl (57.4 kB view details)

Uploaded CPython 3.4m Windows x86

File details

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

File metadata

  • Download URL: bonsai-0.9.1.tar.gz
  • Upload date:
  • Size: 108.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bonsai-0.9.1.tar.gz
Algorithm Hash digest
SHA256 78d216b5d6fef1f817766557e5c40bc286233f5342dd897f35cb2c16dca09152
MD5 318bb5bc1561b6e4806eef9f3624918f
BLAKE2b-256 728fb63ae15a0d2dad874c648ba912515a9335a4c918a0ec22adeefa80567df0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-0.9.1-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 36e2e25257d051ba80143d93084351c5b09956ce6ff24c240969963df36ee6b2
MD5 209a4a9e3e263df440a6a671680bbc15
BLAKE2b-256 eb383d22d18c21b82c9e0a18af8568e2ad258066f34963f9f2678437f6574c51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-0.9.1-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 f398db78bed220415e87b746ebadb41a984df01eec899c69bea59dbb40abc3f9
MD5 e5535b639ffab01de9227cd03bb04e3b
BLAKE2b-256 7ed49939d1774a450aca20c5fedc502fd2598aff5165eb8f454893ecda6044e0

See more details on using hashes here.

File details

Details for the file bonsai-0.9.1-cp36-cp36m-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for bonsai-0.9.1-cp36-cp36m-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d657c0d92a6e1db8ffa6ce4cc8f3b137ae4e30e178bb18aebd3338459c6dcbe9
MD5 b10060e465d55144f11eadce73176fcb
BLAKE2b-256 2b57f33c509ef4fbcbd3227a886b4088046838d1c1b59135a4d4e741b7b78e98

See more details on using hashes here.

File details

Details for the file bonsai-0.9.1-cp35-cp35m-win_amd64.whl.

File metadata

File hashes

Hashes for bonsai-0.9.1-cp35-cp35m-win_amd64.whl
Algorithm Hash digest
SHA256 af4315e637d05782f94fcee69e84f76d9dcb4c43f1f5aaca76f05f5f8c481993
MD5 28cf1ccc2a1e2a8ccf125398295ae8d6
BLAKE2b-256 b2b1c7a09a6f6231d72f63b84a0791c9d022909f2059fdd1083ff8a3758d3abb

See more details on using hashes here.

File details

Details for the file bonsai-0.9.1-cp35-cp35m-win32.whl.

File metadata

File hashes

Hashes for bonsai-0.9.1-cp35-cp35m-win32.whl
Algorithm Hash digest
SHA256 d8eb78bb842023049f6a323d384cd05fbbd82f81db0ec7b71b5d12ce09eb718d
MD5 5aac1732545635041de99c5036cfbf76
BLAKE2b-256 6e37135a06f8bad0c2b0baa3c532b1ec813f4ae85c73ecfc32a03d306ea5dd18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-0.9.1-cp34-cp34m-win_amd64.whl
Algorithm Hash digest
SHA256 8ee5345351010046ff52044f2811c26f561d0101e99893386a6635d418d918db
MD5 21fd4fc9d0102ed05611fae695a3be64
BLAKE2b-256 774224326eee316c787cca9b327d99c360bf4be6c1e993b7a6164d80deb00f1f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bonsai-0.9.1-cp34-cp34m-win32.whl
Algorithm Hash digest
SHA256 d31e550b3bccc1cc15fb8c17cad8ae385f8b8feb8e093d6bd3974cd1a1b3377f
MD5 49be6d6ead4341d0a736d46bf190e2a3
BLAKE2b-256 d1eb6cdfd4b2b46b0dea9b467b6821ebbb164fc4b3f9aaa097cdeec57a2174af

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