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..
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..
设置ldap.OPT_NETWORK_TIMEOUT
ldap 对象的选项。
import ldap
l = ldap.initialize('ldap://servername:389')
l.set_option(ldap.OPT_NETWORK_TIMEOUT, 10.0)
l.simple_bind_s('username', 'password')
如果达到指定的超时,这将引发 ldap.SERVER_DOWN 异常。
出于某种原因ldap.OPT_NETWORK_TIMEOUT
,我似乎永远不会超时,所以我ldap.OPT_TIMEOUT
改用了(这会提高ldap.TIMEOUT
):
import ldap
l = ldap.initialize('ldaps://ldap.example.com')
l.set_option(ldap.OPT_TIMEOUT, 10)
l.simple_bind_s('username', 'password')