A strictly RFC 4510 conforming LDAP V3 pure Python client library
81
Build helpers that exercise extended directory operations to confirm authentication context, rotate credentials, fetch paginated search results, and observe live updates.
@generates
from collections.abc import Callable
from typing import Any
def fetch_bound_identity(config: dict[str, Any]) -> str:
"""
Opens a directory session using config (host, credentials, TLS and other options)
and returns the server's reported identity for the bound user.
"""
def rotate_password(config: dict[str, Any], target_dn: str, old_password: str, new_password: str) -> bool:
"""
Updates the target user's password using extended operations and verifies the
change by attempting a bind with the new password.
"""
def paged_lookup(config: dict[str, Any], base_dn: str, search_filter: str, attributes: list[str]) -> list[dict[str, Any]]:
"""
Executes a paginated search and returns all entries as dictionaries containing
only the requested attributes, sorted by DN.
"""
def monitor_changes(
config: dict[str, Any],
base_dn: str,
search_filter: str,
on_event: Callable[[dict[str, Any]], None],
runtime_seconds: int = 5,
) -> list[dict[str, Any]]:
"""
Runs a persistent search for the given interval, invokes on_event for each change
in the order they arrive, and returns a list of the change payloads observed.
"""Provides LDAP client features, including extended operations for identity reporting, credential changes, paged searches, and persistent search streams.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-ldap3evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10