[python-ldap] Sizelimit in search

Michael Ströder michael at stroeder.com
Mon Oct 24 20:55:03 CEST 2011


Pietro Bertera wrote:
> Using python-ldap I realized that option OPT_SIZELIMIT during search
> are ignored.
> There is a mistake in my code or OPT_SIZELIMIT is unimplemented in search ?
> 
> How can I limit the search results without using paging searches ?

Use the key-word argument sizelimit:

http://www.python-ldap.org/doc/html/ldap.html#ldap.LDAPObject.search_ext

If you actually want to retrieve the partial results until
ldap.SIZELIMIT_EXCEEDED is raised you have to use the async search method and
retrieve the results as they come. You also might want to use ldap.resiter for
that.

http://www.python-ldap.org/doc/html/ldap-resiter.html

Ciao, Michael.


More information about the python-ldap mailing list