Sunday, 24 September 2017

installing python-ldap support

When installing python-ldap package, we need to prepare the libs required by python-ldap. Some of it are :


  • linux build package
    install using apt-get install build-essential
  • libldap2
    Install using apt-get install libldap2-dev
  • libsasl2
    Install using apt-get install libsasl2-dev

After complete with the prerequisite, python-ldap will be happily installed. To install in python run :

# pip install python-ldap

I am using simpleldap package so install simpleldap will also installing python-ldap.

# pip install simpleldap

To test the python-ldap package do this :


  import ldap
  
  conn = ldap.initialize('ldap://192.168.100.100')
  conn.protocol_version = 3
  conn.set_option(ldap.OPT_REFERRALS,0)
  conn.simple_bind_s('administrator@susu.local', 'secretpassword')

Hope this helps, as i try with many other package, its fails. With python-ldap success now.

0 comments:

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More