簡體   English   中英

是否可以使用python ldap3連接到eDirectory?

[英]Is it possible to connect to eDirectory with python ldap3?

我正在嘗試使用python連接到eDirectory。 它不像使用python連接到活動目錄那樣容易,所以我想知道這是否有可能。 我目前正在運行python3.4

我是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一起使用。

再見,喬瓦尼

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM