[python-ldap] Searching with paged results?
christian at python.org
Thu Feb 11 16:42:51 EST 2021
On 10/02/2021 23.44, John wrote:
> Any pointers on what I'm doing wrong (or directions to documentation, but not just to the below page (I need a little more handholding, apparently)? The "search_filter" and "attributes" variables are good, 'cause I _am_ getting the right results...just not _all_ the results.
> I got as far as https://www.python-ldap.org/en/python-ldap-3.3.0/reference/ldap-controls.html#ldap.controls.libldap.SimplePagedResultsControl but what I tried above isn't quite what I'm after.
you have to use the asynchronous method with
SimplePagedResultsControl(). search_ext_s() doesn't give you the
controls to access the next page cookie.
The conn.search_ext() methods returns a result id.
conn.result3(result_id) gives you a bunch of extra data including result
type and server controls. One of the server controls will be a page
control entry with a new cookie. You have to use that cookie in your
next search_ext() call
You can find an example in the LDAP library of FreeIPA,
More information about the python-ldap