Python を使用して eDirectory に接続しようとしています。Pythonを使用してアクティブディレクトリに接続するのは簡単ではないので、これが可能かどうか疑問に思っています. 私は現在python3.4を実行しています
1 に答える
0
私は 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 で動作するはずです。
さようなら、ジョバンニ
于 2015-04-10T06:19:58.673 に答える