Debian Codegraph @

/

debian python-bonsai 1.5.3+ds-1debian python3-bonsai debian python3-bonsai-doc shell shell-project 0.0.0 cdebianinimakemakefilepythonshelltomlyaml 96 files · 101 symbols
View dependency graph

Depends on

README (full)

Bonsai

:target: https://pypi.python.org/pypi/bonsai/ :alt: PyPI Version

:target: https://actions-badge.atrox.dev/noirello/bonsai/goto?ref=dev :alt: GitHub Action Build Status

:target: https://dev.azure.com/noirello/bonsai/_build :alt: Azure Pipelines Status

:target: https://ci.appveyor.com/project/noirello/bonsai :alt: AppVeyor CI Build Status

:target: https://app.codecov.io/gh/noirello/bonsai/tree/dev/src :alt: Coverage Status

:target: http://bonsai.readthedocs.org/en/latest/ :alt: Documentation Status

:target: https://raw.githubusercontent.com/noirello/bonsai/master/LICENSE :alt: 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.

dir .ci/
dir .github/
dir debian/
dir docs/
dir src/
dir tests/
file .appveyor.yml
file .codecov.yml
file .coveragerc
file .gitignore
file .readthedocs.yaml
file CHANGELOG.rst
file LICENSE
file MANIFEST.in
file README.rst
file azure-pipelines.yml
file pyproject.toml
file setup.cfg
file setup.py