hi ,
I am new to Python Ldap programming,
I am trying to read the user details from Active directory using
LDAP(python)
I am getting errors :
                     [EMAIL PROTECTED]:~/Desktop/UploadCards$ python ldap1.py
                     successfull
                     {'info': '00000000: LdapErr: DSID-0C090627, comment: In
order to perform this operation a successful bind must be completed on the
connection., data 0, vece', 'desc': 'Operations error'}

Anyone can tell me whats wrong in my code ?

[Code]

import ldap
try:
    l = ldap.open("101.1.1.2")
    l.protocol_version = ldap.VERSION3
    username = "cn=raj,o=any.com"
    password  = "secret"
    keyword = "ldap"
    l.simple_bind(username, password)

    print "successfull"

    base=""
    scope=ldap.SCOPE_SUBTREE
    filter ="cn=" + "*" + keyword + "*"
    retrieve_attributes = None
    count = 0
    result_set = []
    timeout = 0
    try:
               result_id = l.search(base, scope, filter,
retrieve_attributes)
        while 1:


                  result_type, result_data =
l.result(result_id,timeout)----------->
throwing Exceptions

                   if (result_data == []):
                           break
                   else:
                           if result_type == ldap.RES_SEARCH_ENTRY:
                               result_set.append(result_data)
                    print "%d.\nName: %s\nDescription: %s\nE-mail:
%s\nPhone: %s\n" % (count)
        except ldap.LDAPError, error_message:
               print error_message

except ldap.LDAPError, e:
    print e

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to