From: Asaf S. <as...@as...> - 2003-11-03 11:12:53
|
Hello, I have some directory that looks like this: Dc=3Daup Ou=3Dcustomers Ou=3DCustomer's name =20 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. =20 My code look like this: =20 import ldap conn =3D ldap.initialize("ldap://ldap_server") conn.set_option(ldap.VERSION, ldap.VERSION3) conn.simple_bind_s(ADMIN_USER) =20 dn=3D"ou=3DCustomers,dc=3Dalwaysup" res =3D conn.search_s(dn, ldap.SCOPE_ONELEVEL, "objectClass=3D*", []) =20 for name,attrs in res: print name =20 ofcourse it prints the whole path, output is something like that: ou=3DCustomerName,ou=3DCustomers,dc=3Daup =20 I just want to get a list of 'CustomerName', even without the OU. =20 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. |