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.5.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.5-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ldappool3-0.0.5.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.5.tar.gz
Algorithm Hash digest
SHA256 0d6d576ee09a2878383dc3d3b26252b850ffde9217276b21d433ab238914eb01
MD5 a0174039d197d9140609eb0875d89ebd
BLAKE2b-256 cea910e6f437167d57ef6cb10ed2f54dac4416792240d1614816e0a0edc55772

See more details on using hashes here.

Provenance

The following attestation bundles were made for ldappool3-0.0.5.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.5-py3-none-any.whl.

File metadata

  • Download URL: ldappool3-0.0.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 26472eb2ad9376a3ac2477651d817ecd9cacc0004c34b283ceac18f7f3144a2d
MD5 d5bcd40283e684fdb94933baef2bd8fe
BLAKE2b-256 9a1bd7ce3e36013603f14a1d71ab597d469061365adc8ffb7a3ea04b600cf08c

See more details on using hashes here.

Provenance

The following attestation bundles were made for ldappool3-0.0.5-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