You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
fromtwisted.internetimportreactor, deferfromldaptor.protocols.ldapimportldapclient, ldapsyntax, ldapconnector@defer.inlineCallbacksdefexample():
# The following arguments may be also specified as unicode strings# but it is recommended to use byte strings for ldaptor objectsserverip=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=yieldc.connect(basedn, overrides=overrides)
yieldclient.bind(binddn, bindpw)
o=ldapsyntax.LDAPEntry(client, basedn)
results=yieldo.search(filterText=query)
forentryinresults:
print(entry.getLDIF())
if__name__=='__main__':
df=example()
df.addErrback(lambdaerr: 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: