Skip to main content

A Pure-Python Twisted library for LDAP

Project description

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():
   serverip = '192.168.128.21'
   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())
   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 (runs on port 38942):

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

Dependencies:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ldaptor-16.0.1.tar.gz (273.4 kB view details)

Uploaded Source

Built Distribution

ldaptor-16.0.1-py2.py3-none-any.whl (164.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ldaptor-16.0.1.tar.gz.

File metadata

  • Download URL: ldaptor-16.0.1.tar.gz
  • Upload date:
  • Size: 273.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for ldaptor-16.0.1.tar.gz
Algorithm Hash digest
SHA256 6b9ebe5814e9e7091703c4e3bfeae73b46508b4678e2ff403cddaedf8213815d
MD5 2bda97c508c4fa3a269f40209f6e5311
BLAKE2b-256 d976a25321b8941bf02e24b4923273caaf531890fb092a06f14d62c1683b11a2

See more details on using hashes here.

File details

Details for the file ldaptor-16.0.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for ldaptor-16.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 77ee958076d0bcf78d104057141232f17c53f5d49033dad12a84989dbe5be504
MD5 b178085a5b6862e86fec11d93adaff28
BLAKE2b-256 43d8c5cd0d2e6eda11cb4e7bf61e1db892be27e325a5c505daf45919288e46c2

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page