Skip to main content

Ldaptor

Codecov Read the Docs GitHub Actions PyPI Black

Ldaptor is a pure-Python library that implements:

  • LDAP client logic

  • separately-accessible LDAP and BER protocol message generation/parsing

  • ASCII-format LDAP filter generation and parsing

  • LDIF format data generation

  • Samba password changing logic

Also included is a set of LDAP utilities for use from the command line.

Verbose documentation can be found on ReadTheDocs.

Quick Usage Example

from twisted.internet import reactor, defer
from ldaptor.protocols.ldap import ldapclient, ldapsyntax, ldapconnector

@defer.inlineCallbacks
def example():
    # The following arguments may be also specified as unicode strings
    # but it is recommended to use byte strings for ldaptor objects
    serverip = b'192.168.128.21'
    basedn = b'dc=example,dc=com'
    binddn = b'bjensen@example.com'
    bindpw = b'secret'
    query = b'(cn=Babs*)'
    c = ldapconnector.LDAPClientCreator(reactor, ldapclient.LDAPClient)
    overrides = {basedn: (serverip, 389)}
    client = yield c.connect(basedn, overrides=overrides)
    yield client.bind(binddn, bindpw)
    o = ldapsyntax.LDAPEntry(client, basedn)
    results = yield o.search(filterText=query)
    for entry in results:
        print(entry.getLDIF())

if __name__ == '__main__':
    df = example()
    df.addErrback(lambda err: err.printTraceback())
    df.addCallback(lambda _: reactor.stop())
    reactor.run()

Installation

Ldaptor can be installed using the standard command line method:

python setup.py install

or using pip from PyPI:

pip install ldaptor

Linux distributions may also have ready packaged versions of Ldaptor and Twisted. Debian and Ubuntu have quality Ldaptor packages that can be installed e.g., by:

apt-get install python-ldaptor

To run the LDAP server (bind port 38942) from a repo checkout with the project installed:

twistd -n --pidfile=ldapserver.pid --logfile=ldapserver.log \
    -y test-ldapserver.tac

Dependencies:

Release files for ldaptor 21.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ldaptor 21.2.0
File Size Uploaded
ldaptor-21.2.0.tar.gz 301.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ldaptor 21.2.0
File Interpreter ABI Platform
ldaptor-21.2.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 480.9 kB

Release files / ldaptor-21.2.0.tar.gz

Download URL ldaptor-21.2.0.tar.gz
Size 301.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8c49eb19375d4aab3e5b835860614e0cb17e56bb5a20e1874808fa5bec67a358
BLAKE2b-256 checksum
How to use checksums
e74f15a982993f9deb931db600301468890228f4eb9a525fdd91eb160c32a31d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.8

Release files / ldaptor-21.2.0-py2.py3-none-any.whl

Download URL ldaptor-21.2.0-py2.py3-none-any.whl
Size 179.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
70521851c74b67b340619fc58bb7105619714e40287309572edb6e86f6d75bd0
BLAKE2b-256 checksum
How to use checksums
bb46dc64e99bdb84d76db673de4b86447626a99bd121335f5496491645b764a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.8.8

Release history Release notifications | RSS feed

This release

21.2.0 This release

2 release files

20.1.0

2 release files

20.0.0

2 release files

19.1.0

2 release files

14.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page