CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-ldap3

tessl install tessl/pypi-ldap3@1.4.0

A strictly RFC 4510 conforming LDAP V3 pure Python client library

Agent Success

Agent success rate when using this tile

81%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.08x

Baseline

Agent success rate without this tile

75%

task.mdevals/scenario-7/

LDAP Search Result Exporter

A utility that performs a directory search and exposes results both as structured data and as serialized JSON/LDIF for reuse.

Capabilities

Capture search results

  • Performs a search using provided connection/search parameters and returns both structured entries and raw response metadata for the last operation. @test

JSON export

  • Produces a JSON-formatted string representing the last search response and writes it to a file when a json_path is provided. @test

LDIF export

  • Produces an LDIF-formatted string representing the last search response and writes it to a file when an ldif_path is provided. @test

Empty result handling

  • When the search matches no entries, returns empty entries while still producing valid JSON and LDIF representations that indicate zero entries. @test

Implementation

@generates

API

from dataclasses import dataclass
from typing import Any, Iterable, Optional

@dataclass
class SearchRequest:
    server_uri: str
    base_dn: str
    search_filter: str
    attributes: Optional[Iterable[str]] = None
    bind_dn: Optional[str] = None
    password: Optional[str] = None
    json_path: Optional[str] = None
    ldif_path: Optional[str] = None

@dataclass
class ExportResult:
    entries: list[Any]
    raw_response: list[Any]
    json_text: str
    ldif_text: str
    json_file: Optional[str]
    ldif_file: Optional[str]

def export_search(request: SearchRequest) -> ExportResult:
    """
    Perform the directory search with the provided parameters, returning collected entries,
    raw response data, serialized JSON/LDIF strings, and any file paths written.
    """

Dependencies { .dependencies }

ldap3 { .dependency }

Use this package to connect to the directory, execute the search, access entries/responses, and serialize results to JSON and LDIF. @satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/ldap3@1.4.x
tile.json