Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 62 lines (41 sloc) 1.972 kB
74a7e54 @billrest more docs
billrest authored
1 ldappool
2 ========
3
4 A simple connector pool for python-ldap.
5
6 The pool keeps LDAP connectors alive and let you reuse them,
7 drastically reducing the time spent to initiate a ldap connection.
8
9 The pool has useful features like:
10
11 - transparent reconnection on failures or server restarts
12 - configurable pool size and connectors timeouts
13 - configurable max lifetime for connectors
14 - a context manager to simplify acquiring and releasing a connector
15
e1a83be @billrest simplified setup
billrest authored
16 **You need python-ldap in order to use this library**
17
74a7e54 @billrest more docs
billrest authored
18
19 Quickstart
20 ::::::::::
21
22 To work with the pool, you just need to create it, then use it as a
23 context manager with the *connection* method::
24
25 from ldappool import ConnectionManager
26
27 cm = ConnectionManager('ldap://localhost')
28
29 with cm.connection('uid=adminuser,ou=logins,dc=mozilla', 'password') as conn:
30 .. do something with conn ..
31
32
33 The connector returned by *connection* is a LDAPObject, that's binded to the
34 server. See http://www.python-ldap.org/ for details on how to use a connector.
35
36
37 ConnectionManager options
38 :::::::::::::::::::::::::
39
40 Here are the options you can use when instanciating the pool:
41
42 - **uri**: ldap server uri **[mandatory]**
43 - **bind**: default bind that will be used to bind a connector.
44 **default: None**
45 - **passwd**: default password that will be used to bind a connector.
46 **default: None**
47 - **size**: pool size. **default: 10**
48 - **retry_max**: number of attempts when a server is down. **default: 3**
49 - **retry_delay**: delay in seconds before a retry. **default: .1**
50 - **use_tls**: activate TLS when connecting. **default: False**
51 - **timeout**: connector timeout. **default: -1**
52 - **use_pool**: activates the pool. If False, will recreate a connector
53 each time. **default: True**
54
55
56 The **connection** method takes two options:
57
58 - **bind**: bind used to connect. If None, uses the pool default's.
59 **default: None**
60 - **passwd**: password used to connect. If None, uses the pool default's.
61 **default: None**
Something went wrong with that request. Please try again.