simpleldap
About
A small wrapper around the python-ldap library that provides a more Pythonic interface for LDAP server connections, LDAP objects, and the common get and search operations.
Installation
Install using pip:
pip install simpleldap
Examples
A quick and easy example using simpleldap:
>>> import simpleldap
>>> conn = simpleldap.Connection('directory.example.com')
>>> user = conn.get("uid=myuser")
>>> user.dn
'uid=myuser,dc=directory,dc=example,dc=com'
>>> user['cn']
['Joe Smith', 'Joe M. Smith']
>>> user.first('cn')
'Joe Smith'
>>> conn.close()
The Connection object can also be used as a context manager, e.g.:
with simpleldap.Connection('directory.example.com') as conn:
users = conn.search("(&(givenName=Joe)(sn=Smith))")
A common method for authenticating users is to connect to an LDAP server using a service user/account and then attempt a bind operation using the user’s credentials (i.e. DN and password). The authenticate method makes this simple:
with simpleldap.Connection('directory.example.com') as conn:
is_valid = conn.authenticate('uid=myuser,dc=directory,dc=example,dc=com', 'password')
LDAP also offers a feature to compare an attribute’s value with a given string. This can occasionally be more efficient and expressive than grabbing an entire object from the LDAP store. simpleldap offers a compare method for this feature:
>>> conn = simpleldap.Connection('directory.example.com')
>>> user_dn = 'uid=myuser,dc=directory,dc=example,dc=com'
>>> conn.compare(user_dn, 'cn', 'Joe Smith')
True
Metadata
Release files for simpleldap 0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simpleldap-0.8.tar.gz | 8.9 kB | Without provenance | Details for simpleldap-0.8.tar.gz |
Release files / simpleldap-0.8.tar.gz
| Download URL | simpleldap-0.8.tar.gz |
|---|---|
| Size | 8.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5916680a7fe1b2c5d74dc76351be2941d03b7b94a50d8520280e3f588a84e61
|
|
BLAKE2b-256 checksum How to use checksums |
0c5b65ba72ba47a0bc636175635eadd3dce438df949232b7ed561af44e30be3c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for simpleldap 0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.