I'm new to ldap3 library and I'm trying to build a function that need to search ldap for 55.000 uids and retrieve their mail attribute.
Here is what it looks like :
def ldapsearch(i):
server = Server('myserverurl:389')
try:
with Connection(server) as conn:
conn.search('ou=people,dc=xxx,dc=fr', '(&(objectclass=person)(uid='+i+'))', attributes=['mail', 'cn', 'uid'])
entry = conn.entries[0]
except:
return'error search operation'
else:
if (len(entry)!=0):
return entry['mail']
else:
return'error uid not found'
But I can't get it working... Any idea ?
Thx in advance for your help, Nicolas