【问题标题】:Is it possible to connect to eDirectory with python ldap3?是否可以使用 python ldap3 连接到 eDirectory?
【发布时间】:2015-04-08 20:45:10
【问题描述】:

我正在尝试使用 python 连接到 eDirectory。它不像使用 python 连接到活动目录那么容易,所以我想知道这是否可能。我目前正在运行 python3.4

【问题讨论】:

  • 当然可以。你试过什么?

标签: python active-directory ldap edirectory


【解决方案1】:

我是 ldap3 的作者,我使用 eDirectory 来测试库。

试试下面的代码:

from ldap3 import Server, Connection, ALL, SUBTREE
server = Server('your_server_name', get_info=ALL)  # don't user get_info if you don't need info on the server and the schema
connection = Connection(server, 'your_user_name_dn', 'your_password')
connection.bind()
if connection.search('your_search_base','(objectClass=*)', SUBTREE, attributes = ['cn', 'objectClass', 'your_attribute'])
    for entry in connection.entries:
        print(entry.entry_get_dn())
        print(entry.cn, entry.objectClass, entry.your_attribute)
connection.unbind()

如果您需要安全连接,只需将服务器定义更改为:

server = Server('your_server_name', get_info=ALL, use_tls=True)  # default tls configuration on port 636

此外,https://ldap3.readthedocs.org/en/latest/quicktour.html 文档中的任何示例都应适用于 eDirectory。

再见, 乔瓦尼

【讨论】:

    猜你喜欢
    • 2023-03-10
    • 2011-04-23
    • 1970-01-01
    • 2021-08-05
    • 1970-01-01
    • 1970-01-01
    • 2015-06-04
    • 1970-01-01
    • 2013-06-01
    相关资源
    最近更新 更多