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/
Release files for ldap-hopper 3.3.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ldap_hopper-3.3.7.tar.gz | 28.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ldap_hopper-3.3.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.0 kB
Release files / ldap_hopper-3.3.7.tar.gz
| Download URL | ldap_hopper-3.3.7.tar.gz |
|---|---|
| Size | 28.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07a9b743bfbd0a1a3b30fc5da7df1a0ec837b6551188802e67538d815bf94c44
|
|
BLAKE2b-256 checksum How to use checksums |
64502c5d82ebe4434a5fe55659a208b908fa3447c9f8c2608bebde519ef081af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|
Release files / ldap_hopper-3.3.7-py3-none-any.whl
| Download URL | ldap_hopper-3.3.7-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de299dd9f4aaddf272bc59daa0c072296ebf3561dd3ca6a9ef10e6572d446807
|
|
BLAKE2b-256 checksum How to use checksums |
7fbec29b9133124da4ffd83521bf6385a93070600938b9c4067cc1cea865d27f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|