문제

I see there is a way for me page the results in python and I found the following example code: https://bitbucket.org/jaraco/python-ldap/src/f208b6338a28/Demo/paged_search_ext_s.py

When I copy this code and try to modify it to what I need it to do when running the code I get a "TypeError: init() got an unexpected keyword argument 'cookie'"

I even reverted the code back to its default and get the same error. If someone could point me in the correct direction it would be much appreciated.

Thanks

도움이 되었습니까?

해결책

Update your python-ldap module:

pip install python-ldap --upgrade

That class changed from this commit and mentioned:

new class API in ldap.controls, not backwards-compatible!

다른 팁

The problem is on this line:

req_ctrl = SimplePagedResultsControl(True,size=self.page_size,cookie='')

Find where that SimplePagedResultsControl class is defined and examine the parameter list for its constructor to get the correct constructor parameter list.

EDIT:

Looks like the constructor signature has been changed. Either upgrade as Omid Raha recommends or try the old method signature below if you are unable to upgrade for some reason.

paged_results_control = SimplePagedResultsControl(ldap.LDAP_CONTROL_PAGE_OID, True, (self.page_size, ''))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top