質問

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