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.3.tar.gz (4.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.3-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ldappool3-0.0.3.tar.gz
  • Upload date:
  • Size: 4.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.3.tar.gz
Algorithm Hash digest
SHA256 7c780ecf196c4b280f4af9dfd781fc21ea54a0a944d92cbb1baccae810831b3f
MD5 ec178fa1ae64d095f5af54b85ec8f5eb
BLAKE2b-256 e748df993086318d64c534281c88a4ee1d0d5a51e191fb8129be9af1c3f4010b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: ldappool3-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.9 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f1eb6536a5d70be56d7d334b703183b5469bed3bb3be1929862870ec7449bbbf
MD5 1a2aeb33b5d594f2260117551e35c94b
BLAKE2b-256 af752220abd81147111a5bad0cfda950def71ee5cf051cf1f51d10d9e65d556e

See more details on using hashes here.

Provenance

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