python ldap3

If you install ldap3==2.5 on python 3.8, you will get error message: strategy.async import AsyncStrategy.
the reason is async and await have become keywords from Python 3.7!

ldap3==2.4.1 is working good on python 3.7/8

(base) ubuntu@ubunu2004:~$ pip install ldap3==2.4.1
test the LDAP connection with sample code:

from ldap3 import Server, Connection, ALL
server = Server('localhost', get_info=ALL)
conn = Connection(server, 'cn=admin,dc=linuxvmimagrs,dc=local', 'pas8word', auto_bind=True)
conn.search('dc=linuxvmimagrs,dc=local', '(objectclass=person)')
print(conn.entries)

(base) ubuntu@ubunu2004:~$ python test.py
[DN: uid=hanszhu,ou=people,dc=linuxvmimagrs,dc=local – STATUS: Read – READ TIME: 2020-07-15T22:21:43.384934

we can get more examples:
https://www.programcreek.com/python/example/107944/ldap3.ALL

Leave a Reply

Your email address will not be published. Required fields are marked *