Monday, April 6, 2009

python-ldap

一: Connection

二: binding

authentication mechanism:
1. credential
1. SASL

三: Synchronous and Asynchronous
First, for many Python LDAP functions, including almost all of the LDAP operations, there are both synchronous and asynchronous versions.
Synchronous versions, which will block until the server returns a result, have method names that end with _s.

The other operations – those that do not end with _s – are asynchronous. An asynchronous message will begin an operation, and then return control to the program.
The operation will continue in the background. It is the responsibility of the program to periodically check on the operation to see if it has been completed.
异步方式的使用:
>>> con.simple_bind( dn, pw )
8
>>> con.result(8)
(97, [ ])

使用异步需要注意到如下:
1. annot call result() with the same message ID multiple times.
2. The consequence of doing this is that all of the results will be stored until they are fetched. This consumes memory, and can lead to confusing results if result() or result( ldap.RES_ANY ) is called.

related docs: http://www.packtpub.com/article/installing-and-configuring-the-python-ldap-library-and-binding-to-an-ldap-directory

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.