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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ldappool3-0.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 a6077ea904e7978accff24be724412544b5bf425af7b5ffb786aa67f954ded84
MD5 0fbe83291f09984ef21c3cdaf9f83519
BLAKE2b-256 1192646b626fed312293b4d1d9398c73334907d266769a61e7e4e66ec8502287

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ldappool3-0.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f098a5e89f654189bc63fb39d09a8d941808db3fd97cff8be927257d6cc1214d
MD5 97597d880a29862d2f629dc3103a45fb
BLAKE2b-256 704139f1faaa92c6fcfc92eacae9f8d51058e00ac7e0ea2b60298e6ffbc4dce5

See more details on using hashes here.

Provenance

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