Skip to main content

'Client library for fast+easy access and manipulation of an LDAP directory-information-tree(DIT).'

Project description

LDAP-Hopper

ldap_hopper is a small Python3 package that allows you to easily navigate and manipulate an LDAP directory-information-tree(DIT). It neatly wraps around the standard ldap package and takes away all the nasty bits and pieces of boiler-plating, while making your code more readable.

Installation

pip install ldap_hopper

Usage

#!/usr/bin/env python3
from ldap_hopper import Config, Cursor

# define an access configuration
config = Config(
    server='ldap://localhost',
    dn='dc=example.dc=com',
#    bind_dn='',
#    bind_pw='',
#    use_tls=True,
)

# creating a cursor
root = Cursor(config)
print(root.attrs)

# traversal via standard generators
[child for child in root.children]
[sub for sub in root.subtree]

# adding a child node
dn = 'ou=crew,dc=example,dc=com'
attrs = {
    'objectClass': ['organizationalUnit'],
    'ou': ['crew'],
}
cursor = root.add(dn, attrs)

# searching defaults to ldap.SCOPE_SUBTREE
[result for result in root.search('ou=crew')]

from ldap_hopper import Scope
[r for r in root.search('objectClass=*', Scope.onelevel)]

# manipulating attributes
cursor.attrs['description'] = 'Lorem ipsum...'
del cursor.attrs['desciption']

# deleting an entire object
cursor.delete()

Development

git clone github.com:baccenfutter/ldap_hopper.git
cd ldap_hopper
pipenv install --dev

Resources

Source: https://github.com/baccenfutter/ldap_hopper
PyPi : https://pypi.python.org/pypi/ldap_hopper/

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ldap_hopper-3.3.2-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file ldap_hopper-3.3.2-py3-none-any.whl.

File metadata

  • Download URL: ldap_hopper-3.3.2-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.6.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.9

File hashes

Hashes for ldap_hopper-3.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 53de742e009ff9c0c94458f423655e0369cccc42bf835bb6104a73f231bb6121
MD5 66eb07233594bb93d8306bdcc59c9e24
BLAKE2b-256 c14e0f3e8d6a31cace86192a8f90668761cf9bb9feb354df79be9979264aa2d9

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