Skip to main content

Simple access to LDAP Directory Information Tree.

Project description

LDAP-Hopper is a simplistic Python binding for accessing an LDAP Directory Information Tree(DIT).:

#!/usr/bin/env python
from ldap_hopper import ObjectNode

# access the root-node
ObjectNode.SERVER = 'localhost'
base_dn = 'dc=example,dc=org'
bind_dn = 'cn=admin,dc=example,dc=org'
bind_pw = 'secret'
root = ObjectNode(base_dn, bind_dn, bind_pw)

# show attributes of root-node
print root.attrs

# get childs of root
print root.get_childs()

# get subtree of root
print root.get_subs()

# add child node
attrs_1 = {
    'objectClass': ['organizationalUnit'],
    'ou': ['node_1'],
}
attrs_2 = {
    'objectClass': ['organizationalUnit'],
    'ou': ['node_2'],
}
node_1 = root.add_child('ou=node_1,dc=example,dc=org', attrs)
node_2 = root.add_child('ou=node_2', attrs)     # will auto-expand self.dn
print node_1, node_2

# delete child node
root.del_child('ou=node_1,dc=example,dc=org')
root.del_child('ou=node_2')                     # shortcut also allowed

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

LDAP-Hopper-0.2.0.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file LDAP-Hopper-0.2.0.tar.gz.

File metadata

  • Download URL: LDAP-Hopper-0.2.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for LDAP-Hopper-0.2.0.tar.gz
Algorithm Hash digest
SHA256 141c1f79668615c662cdd243a5e75786d209f4d9a7bc02862453fad361d744b0
MD5 b2d30cfd0a1cb5ea1822158a6c82660b
BLAKE2b-256 af249cae076220b6b5676c9e854eadfa0e3e7ddc9310a537f0e402acc6ef1649

See more details on using hashes here.

Supported by

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