python-libldap is a Python binding for libldap (LDAP client library). libldap is provided by OpenLDAP.
This project requires Python version 3.4 or later (not Python 2). If you want to use libldap wrapper library with Python 3, please try it.
https://yykamei.github.io/python-libldap/
Python >= 3.4
libldap
libsasl2
Python developer package >= 3.4
libldap developer package
libsasl2 developer package
Install with pip install python-libldap
Under the MIT license.
If you have any suggestions or bug reports please report them to the issue tracker at https://github.com/yykamei/python-libldap/issues .
>>> from libldap import LDAP, LDAP_SCOPE_SUB
>>> ld = LDAP('ldap://localhost/')
>>> ld.bind('cn=master,dc=example,dc=com', 'secret')
>>> ld.search('dc=example,dc=com', LDAP_SCOPE_SUB, '(objectClass=*)')
[...]
>>> from libldap import LDAP
>>> ld = LDAP('ldap://localhost/')
>>> ld.bind('cn=master,dc=example,dc=com', 'secret')
>>> ld.add('cn=group1,ou=Groups,dc=example,dc=com', [
... ('objectClass', ['top', 'posixGroup']),
... ('cn', ['group1']),
... ('gidNumber', ['100']),
... ('description', ['Test Group 1']),
... ])
>>>
>>> from libldap import LDAP, LDAP_MOD_REPLACE
>>> ld = LDAP('ldap://localhost/')
>>> ld.bind('cn=master,dc=example,dc=com', 'secret')
>>> ld.modify('cn=group1,ou=Groups,dc=example,dc=com', [
... ('gidNumber', ['101'], LDAP_MOD_REPLACE),
... ])
>>>
>>> from libldap import LDAP
>>> ld = LDAP('ldap://localhost/')
>>> ld.bind('cn=master,dc=example,dc=com', 'secret')
>>> ld.delete('cn=group1,ou=Groups,dc=example,dc=com')
>>>
- Fix: Fix memleak
- HAMANO Tsukasa [email protected]
- Fix: fix for binary attribute
- HAMANO Tsukasa [email protected]
- Add: Travis CI testing
- Fix: LDAP.rename() description
- Fix: Encoding error and getting size of characters
- Fix: Get LDAP value length by using Pychon/C API in str2berval()
- LDAP constructor receives start_tls parameter
- LDAP_OPT_REFERRALS is False by default
- LDAP constructor receives options parameter
- Fix: We raise LDAPAPIError
- Add LDAP Exceptions which inherit LDAPError
- LDAP class constructor receives list of uri
- LDAP class supports context manager
- Change LDAP entries value type from str to bytes in LDAP.search_result()
- Change LDAP entry object (object has 'dn' attribute) in LDAP.search_result()
- Change deleteoldrdn default value from True to False in LDAP.rename()