[python3-ldap] Key error help

Joseph L. Casale jcasale at activenetwerx.com
Fri Mar 21 23:54:52 CET 2014


> It is querying against Windows Server 2012 Active Directory. If I perform the search
> on those URI's I dont believe it will return any of my users. Those are specific schema
> containers for active directory. Is there a way I can get it to not come back in the response? 

(misdirected the first response...)

Be more robust in your parsing, you are looking for an account object, this has a 'dn' or a
'type' of 'searchResEntry' for example...

        for resp in connection.response:
            if resp['type'] == 'searchResEntry':
                return resp['dn'], resp['attributes']

Additionally, don't index an object you don't know exists. Check for it first for example...

hth,
jlc


More information about the python3-ldap mailing list