# Bonsai’s documentation

Bonsai is an LDAP module for Python 3, using OpenLDAP’s libldap2 library on Linux, and the WinLDAP library on Microsoft Windows to handle communications with LDAP capable directory servers. The module main goal is to give a simple way to use the LDAP protocol as pythonic as it can be.

Note

The module is compatible only with Python 3.6 or newer releases.

## 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).

## Contents

- Installing
  - Using pip
  - Install from source on Linux
  - Install from source on Windows
  - Install from source on Mac OS X
- Quickstart
  - Connecting
  - Searching
  - Add and modify LDAP entry
  - Delete an LDAP entry
  - Rename an LDAP entry
  - Close connection
- Advanced Usage
  - Authentication mechanisms
    - Simple bind
    - Simple Authentication and Security Layer
  - TLS settings
  - LDAP controls
    - Server side sort
    - Paged search result
    - Virtual list view
    - Password policy
    - Extended DN
    - Server tree delete
    - ManageDsaIT
    - SD Flags
  - Using connection pools
  - Reading and writing LDIF files
  - Asynchronous operations
    - Using async out-of-the-box
    - Create your own async class
  - Utilities for Active Directory
    - Security descriptor
    - UserAccountControl
- API documentation
  - bonsai
    - `LDAPClient`
    - `LDAPConnection`
    - `LDAPDN`
    - `LDAPEntry`
    - `LDAPModOp`
    - `LDAPReference`
    - `LDAPSearchScope`
    - `LDAPURL`
    - `LDAPValueList`
  - bonsai.active_directory
    - `ACE`
    - `ACEFlag`
    - `ACERight`
    - `ACEType`
    - `ACL`
    - `ACLRevision`
    - `SecurityDescriptor`
    - `SID`
    - `UserAccountControl`
  - bonsai.asyncio
    - `AIOLDAPConnection`
    - `AIOConnectionPool`
  - bonsai.gevent
    - `GeventLDAPConnection`
  - bonsai.ldif
    - `LDIFReader`
    - `LDIFWriter`
  - bonsai.pool
    - `ConnectionPool`
    - `ThreadedConnectionPool`
  - bonsai.tornado
    - `TornadoLDAPConnection`
  - _bonsai
    - `ldapsearchiter`
  - Errors
  - Utility functions
- Changelog

## Contribution

Any contributions are welcome. If you would like to help in development fork or report issue on the project’s GitHub site. You can also help in improving the documentation.

## Indices and tables

- Index

- Module Index

- Search Page