[python-ldap] python-ldap syncrepl consumer

David Gabriel davidgab283 at gmail.com
Mon Nov 9 05:54:27 EST 2015


Dears,

I am looking for an example of syncrepl process that should be upated based
on any change in the LDAP server.
So, could you please provide a code example dealing with a syncrepl process
that detects any update in the LDAP server in order to handle it locally ?

Herafter, the code I wrote to ensure the connection to the server, but I
don't know how to enhance it to use the syncrepl Consumer API (e.g., using
syncrepl_poll procedure) ?

------------------------
from ldap.syncrepl import SyncreplConsumer
import ldap, sys

link = 'ldap://localhost'
l = ldap.initialize(link)

try:
    l.bind_s("","")
except ldap.INVALID_CREDENTIALS:
    print "Your username or password is incorrect."
    sys.exit()
except ldap.LDAPError, e:
    if type(e.message) == dict and e.message.has_key('desc'):
        print e.message['desc']
    else:
        print e
        sys.exit()

#syncrepl_poll(-1, None,0)
--------------------


Thanks in advance.
Kind regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20151109/0726265a/attachment.html>


More information about the python-ldap mailing list