Searching, Simple question...
Asaf Shakarchi
asaf at asaf.gotdns.com
Mon Nov 3 22:13:30 CET 2003
Hello,
I have some directory that looks like this:
Dc=aup
Ou=customers
Ou=Customer's name
I just want to get a list of the customer's name,
There's anyway to do it? since search_s returns the entire line with the
whole DNS.
My code look like this:
import ldap
conn = ldap.initialize("ldap://ldap_server")
conn.set_option(ldap.VERSION, ldap.VERSION3)
conn.simple_bind_s(ADMIN_USER)
dn="ou=Customers,dc=alwaysup"
res = conn.search_s(dn, ldap.SCOPE_ONELEVEL, "objectClass=*", [])
for name,attrs in res:
print name
ofcourse it prints the whole path, output is something like that:
ou=CustomerName,ou=Customers,dc=aup
I just want to get a list of 'CustomerName', even without the OU.
Well, I guess this is a python question, not an python-ldap one but
maybe there are some functions that make it easy to retrieve only
specific part of the result in python-ldap?
Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20031103/57012703/attachment.html>
More information about the python-ldap
mailing list