A strictly RFC 4510 conforming LDAP V3 pure Python client library
81
Design a small directory search helper that demonstrates scoped searches, alias handling, and paged retrieval against an LDAP-compatible directory.
@generates
from collections.abc import Callable
from typing import Any, Iterable
class DirectorySearchClient:
def __init__(self, connection_factory: Callable[[], Any]):
"""Prepare a client that can obtain a fresh LDAP connection when needed."""
def search(
self,
base_dn: str,
filter_text: str,
attributes: Iterable[str] | None,
scope: str,
deref_aliases: str,
) -> list[dict[str, Any]]:
"""Perform one search using the requested scope (base, one-level, or subtree) and alias handling (e.g., never vs always), returning entries as dictionaries."""
def paged_search(
self,
base_dn: str,
filter_text: str,
attributes: Iterable[str] | None,
page_size: int,
) -> list[list[dict[str, Any]]]:
"""Return ordered pages of entries, following paging markers until exhaustion."""Provides LDAP connectivity, scoped searches, alias dereference controls, and paging helpers.
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