Skip to main content

Gerenciador de conexões LDAP com pooling para otimizar o desempenho em aplicações de alta demanda.

Project description

ldappool

A simple connector pool for python ldap3 library.

The pool keeps LDAP connectors alive and let you reuse them, drastically reducing the time spent to initiate a ldap connection.

The pool has useful features like:

  • transparent reconnection on failures or server restarts
  • configurable pool size and connectors timeouts
  • configurable max lifetime for connectors
  • a context manager to simplify acquiring and releasing a connector

Quickstart ::::::::::

To work with the pool, you just need to create it, then use it as a context manager with the connection method::

    from ldappool3 import LDAPConnectionPool3

    cm = LDAPConnectionPool3(server_url='ldap://localhost', user='user@example.com', password='password123')


    with cm.acquire() as conn:
        conn.search(search_base='DC=EXAMPLE,DC=COM' search_filter='(sAMAccountName=some.user)')

        response = conn.entries

The connector returned by connection is a LDAPObject, that's binded to the server. See https://pypi.org/project/python-ldap/ for details on how to use a connector.

It is possible to check the state of the pool by representing the pool as a string::

from ldappool3 import LDAPConnectionPool3

cm = LDAPConnectionPool3(server_url='ldap://localhost', user='user@example.com', password='password123')

.. do something with cm ..

print(cm)

This will result in output similar to this table::

ldap://localhost:389 - cleartext - user: user@example.com - not lazy - bound - open - <local: localhost:50277 - remote: localhost:389> - tls not started - listening - SyncStrategy - internal decoder
ldap://localhost:389 - cleartext - user: user@example.com - not lazy - bound - open - <local: localhost:59583 - remote: localhost:389> - tls not started - listening - SyncStrategy - internal decoder
ldap://localhost:389 - cleartext - user: user@example.com - not lazy - bound - open - <local: localhost:34709 - remote: localhost:389> - tls not started - listening - SyncStrategy - internal decoder
ldap://localhost:389 - cleartext - user: user@example.com - not lazy - bound - open - <local: localhost:41755 - remote: localhost:389> - tls not started - listening - SyncStrategy - internal decoder
ldap://localhost:389 - cleartext - user: user@example.com - not lazy - bound - open - <local: localhost:56227 - remote: localhost:389> - tls not started - listening - SyncStrategy - internal decoder

LDAPConnectionPool3 options :::::::::::::::::::::::::

Here are the options you can use when instanciating the pool:

  • server_url: ldap server uri [mandatory]
  • user: default bind that will be used to bind a connector.
  • passwd: default password that will be used to bind a connector.
  • user: pool size. default: 5
  • use_pool: activates the pool. If False, will recreate a connector each time. default: True

The uri option can be ldap://server or ldaps://server. If you use ldaps://, the connection will use ssl for encrytpion. The server will perform some operations only in a ssl connection.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ldappool3-0.0.7.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ldappool3-0.0.7-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file ldappool3-0.0.7.tar.gz.

File metadata

  • Download URL: ldappool3-0.0.7.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ldappool3-0.0.7.tar.gz
Algorithm Hash digest
SHA256 a6a95e4208295931dc524328a08fcafa627ad2d799eeaf0b2aa6d15424c2fdb8
MD5 1a27714a3d999974c8564dcb72d6dd48
BLAKE2b-256 9ea1d15f68dc93906190694057af451a8691532da8882c4981269342c0724116

See more details on using hashes here.

Provenance

The following attestation bundles were made for ldappool3-0.0.7.tar.gz:

Publisher: python-publish.yml on dedraks/ldappool3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ldappool3-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: ldappool3-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ldappool3-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 64ba93a7a1711b1c79cbe37ea0b74b45cab8aecd427de2fe82ebae7e88819981
MD5 5d11b7a106eacfa8461836e7ff95bfdb
BLAKE2b-256 92aa3ad8b69471d6cced8d519afbb93553b565360dd4d3995ed7071b44070ebc

See more details on using hashes here.

Provenance

The following attestation bundles were made for ldappool3-0.0.7-py3-none-any.whl:

Publisher: python-publish.yml on dedraks/ldappool3

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page