Registry / auth-security / python3-ldap

python3-ldap

JSON →
library0.9.8.4pypypiunverified

The `python3-ldap` project has been renamed to `ldap3`. This entry documents `python3-ldap` as a deprecated library and strongly advises users to migrate to `ldap3`, which is the actively maintained and current library for interacting with LDAP servers in Python. `ldap3` provides a comprehensive, modern, and high-performance feature set for LDAP client operations, including secure connections (LDAPS/StartTLS), asynchronous operations, and various authentication methods. The current version of `ldap3` is 2.9.1, and it maintains a steady release cadence.

pip install python3-ldap
INSTALL
IMPORT
SIG · PYTHON3-LDAP
P
python3-ldap
auth-securitypythonv0.9.8.4
Install
1.7s avg
Import
260ms
Disk
46MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.8.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.268s · 71.4MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.7s · import 0.252s · 22MB
46MB installed
● package 46MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Server
from ldap3 import Server
from ldap3 import Server

This quickstart demonstrates how to establish a connection to an LDAP server using `ldap3`, bind with simple authentication, and perform a basic search. It's crucial to replace placeholder values with your actual LDAP server details and user credentials. Environment variables are used for sensitive information.

import os from ldap3 import Server, Connection, AUTH_SIMPLE, STRATEGY_SYNC, GET_DSE_INFO # Configure LDAP connection details LDAP_SERVER_IP = os.environ.get('LDAP_SERVER_IP', 'your_ldap_server.example.com') LDAP_USER_DN = os.environ.get('LDAP_USER_DN', 'cn=admin,dc=example,dc=com') # e.g., 'uid=user,ou=users,dc=example,dc=com' LDAP_PASSWORD = os.environ.get('LDAP_PASSWORD', 'admin_password') LDAP_BASE_DN = os.environ.get('LDAP_BASE_DN', 'dc=example,dc=com') try: # Define the LDAP server server = Server(LDAP_SERVER_IP, get_info=GET_DSE_INFO) # Establish a connection conn = Connection(server, user=LDAP_USER_DN, password=LDAP_PASSWORD, authentication=AUTH_SIMPLE) # Bind to the server if not conn.bind(): print(f"Error binding to LDAP: {conn.result}") else: print("Successfully bound to LDAP server.") # Perform a search search_filter = '(objectClass=person)' # Example filter conn.search(LDAP_BASE_DN, search_filter, attributes=['cn', 'mail']) print("\nSearch Results:") for entry in conn.entries: print(f" CN: {entry.cn}, Mail: {entry.mail}") # Unbind from the server conn.unbind() print("Unbound from LDAP server.") except Exception as e: print(f"An error occurred during LDAP operation: {e}")
Debug
Known issues
breakingThe `python3-ldap` project is completely abandoned and has been renamed to `ldap3`. It receives no further updates, bug fixes, or security patches. Using `python3-ldap` is not recommended.
fix
Immediately migrate to `ldap3`. Install with `pip install ldap3` and refactor your code according to `ldap3`'s API documentation.
affects: All versions of `python3-ldap` (0.9.8.4 and earlier).
breakingThe API of `python3-ldap` is entirely incompatible with `ldap3`. Code written for `python3-ldap` will not work with `ldap3` without significant modification, as core classes, functions, and paradigms have changed.
fix
There is no direct migration path. You must rewrite your LDAP interaction logic using `ldap3`'s `Server` and `Connection` classes and its new query syntax.
affects: All versions when migrating from `python3-ldap` to `ldap3`.
gotchaInstalling `python3-ldap` might fail on modern Python versions or specific operating systems due to outdated dependencies or lack of wheel support.
fix
Avoid `python3-ldap`. If you encounter installation issues, it's a strong signal to switch to `ldap3`, which has broad compatibility with current Python versions.
affects: Python 3.9+ and potentially certain OS environments.
Upgrade
Version history
0.9.8.4latest on PyPI · released May 28, 2015
Audit
Dependencies
pyasn1requiredRequired by ldap3 for ASN.1 encoding/decoding.
pyasn1-modulesrequiredRequired by ldap3 for additional ASN.1 modules.
Agent activity
26 hits · last 30 days
node
24
OpenAI (training)
1
Resources
python3-ldap — pip install python3-ldap · libregistry