Welcome to Ldaptor’s documentation!

What is Ldaptor

Ldaptor is a pure-Python Twisted 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

Get it from PyPI, find out what’s new in the Changelog!

Quick Usage Example

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

def example():
    serverip = ''
    basedn = 'dc=example,dc=com'
    binddn = 'bjensen@example.com'
    bindpw = 'secret'
    query = '(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

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

Indices and tables