Is there a way to set timeout for "simple_bind_s" in python-LDAP manually? I have tested ldapObject.timeout = 10 it did not work for me. Any ideas?
Thanks in advance..
Click Security > Global Security. 2. Under Available Realm Definitions, choose "Standalone LDAP registry" and click Configure. This property sets a specified timeout value, in milliseconds, to be used when opening a communications link to the LDAP server.
After trying to connect to the LDAP server during a certain amount of time, Informatica returns a "Timed out" message. In this case, the issue is because the user does not use the proper port to connect to the LDAP server. For an SSL encrypted connection, you must use port 636.
In order to use LDAP with Python we need to import the Server and the Connection object, and any additional constant we will use in our LDAP. As you might remember from the LDAP Protocol diagram the authentication operation is called Bind.
Set the option ldap.OPT_NETWORK_TIMEOUT
for the ldap object.
import ldap
l = ldap.initialize('ldap://servername:389')
l.set_option(ldap.OPT_NETWORK_TIMEOUT, 10.0)
l.simple_bind_s('username', 'password')
This will raise a ldap.SERVER_DOWN exception if the specified timeout is reached.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With