ldap3
A strictly RFC 4510 conforming LDAP V3 pure Python client library
What it is and what it does
ldap3 is a pure Python LDAP V3 client that runs on Python 2, Python 3, PyPy, and PyPy3. It provides RFC 4510-conforming LDAP operations with both a low-level API for direct LDAP commands and a higher-level Abstraction Layer for more pythonic directory interactions. The library includes thread-safe connection strategies (SAFE_SYNC, SAFE_RESTARTABLE, and ASYNC) to handle multithreaded scenarios, each returning a tuple of status, result, response, and request.
The package depends only on pyasn1 for ASN.1 encoding/decoding and installs with minimal friction. It is designed for applications that need to authenticate users, query directory services, or perform LDAP operations against Active Directory, OpenLDAP, or other LDAP-compliant servers. The Abstraction Layer abstracts away the complexity of raw LDAP protocol details, making directory operations more accessible to Python developers.
Use it for:
- Authenticate users against Active Directory or OpenLDAP in web applications or services
- Query LDAP directory servers to retrieve user attributes, group memberships, or organizational structure
- Build user provisioning or account management tools that interact with enterprise directory services
- Implement single sign-on (SSO) systems that validate credentials against LDAP backends
- Automate directory operations in multithreaded applications using SAFE_SYNC or ASYNC strategies
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
ldap3 is a pure Python LDAP V3 client library that implements RFC 4510, providing both low-level LDAP operations and a high-level abstraction layer for directory queries and authentication.
Yes. ldap3 is a stable, actively maintained library with no known vulnerabilities, low install friction, and broad Python version support. It is the standard choice for LDAP operations in Python. The LGPL v3 license requires disclosure but permits use in proprietary applications. Install it if you need to authenticate against or query LDAP directories.
Install
ldap3 on PyPI
pip
pip install ldap3uv
uv add ldap3poetry
poetry add ldap3Installing ldap3
Before you install
Low install friction with a single pure-Python runtime dependency (pyasn1). The package is actively maintained as of 2026-04-18 with no known vulnerabilities, though the latest release is from 2021-07-18.
License in practice
Released under LGPL v3 (copyleft). Any derivative work or modification must be released under the same license; proprietary applications can use it as a library but must disclose the license terms.
Quickstart
pip install ldap3
from ldap3 import Server, Connection, SAFE_SYNC
server = Server('my_server')
conn = Connection(server, 'my_user', 'my_password', client_strategy=SAFE_SYNC, auto_bind=True)
status, result, response, _ = conn.search('o=test', '(objectclass=*)')
Verify before relying
- Whether the Abstract Layer is thread-safe in current versions (description notes it is NOT thread safe as of documentation time)
- Current maintenance status beyond the 2026-04-18 last commit date and whether Python 2 support is still active
Package facts
| License | LGPL v3 (copyleft) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — pyasn1 |
| Maintenance | actively maintained — 1,853 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 18,857,053/month — #1,076 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ldap3-2.9.1-py2.py3-none-any.whl
Keywords: python3, python2, ldap
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
python3-ldapThis package is a redirect to ldap3—a pure…
copyleft · top 15,000 on PyPI
types-ldap3Provides type stubs for the ldap3 package,…
permissive · top 15,000 on PyPI
python-active-directoryAn Active Directory client library for Python…
permissive · top 15,000 on PyPI
python-ldapProvides an object-oriented Python API to…
permissive · top 5,000 on PyPI
ldapdomaindumpCollects and exports Active Directory…
permissive · top 15,000 on PyPI
ldaptorLdaptor is a pure-Python LDAP client library…
permissive · top 5,000 on PyPI
msldapmsldap is a Python library for querying and…
permissive · top 15,000 on PyPI
django-auth-ldapProvides a Django authentication backend that…
permissive · top 15,000 on PyPI
python-freeipapython-freeipa is a lightweight client library…
permissive · top 15,000 on PyPI
qh3qh3 is a Python library implementing the QUIC…
permissive · top 5,000 on PyPI