我去了https://github.com/osixia/docker-openldap并能够进行配置 openldap和phpldapadmin。我能够通过https://localhost:6443
访问phpldapadmin然后我使用pip安装ldap3,并想测试以下代码
server = Server('ldap://localhost:389')
>>> conn = Connection(server)
>>> conn.bind()
引发错误
rom ldap3 import Server,Connection,ALL
server=Server('ldap://localhost:389')
conn=Connection(server)
conn.bind()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/ldap3/core/connection.py", line 524, in bind
self.open(read_server_info=False)
File "/usr/local/lib/python2.7/site-packages/ldap3/strategy/sync.py", line 56, in open
BaseStrategy.open(self, reset_usage, read_server_info)
File "/usr/local/lib/python2.7/site-packages/ldap3/strategy/base.py", line 147, in open
raise LDAPSocketOpenError('unable to open socket', exception_history)
ldap3.core.exceptions.LDAPSocketOpenError: ('unable to open socket', [(LDAPSocketOpenError('socket connection error while opening: [Errno 61] Connection refused',), ('::1', 389, 0, 0)), (LDAPSocketOpenError('socket connection error while opening: [Errno 61] Connection refused',), ('127.0.0.1', 389))])