How to use the ldappool.__init__.BackendError function in ldappool

To help you get started, we’ve selected a few ldappool examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / ldappool / ldappool / __init__.py View on Github external
def _bind(self, conn, bind, passwd):
        # let's bind
        if self.use_tls:
            try:
                conn.start_tls_s()
            except Exception:
                raise BackendError('Could not activate TLS on established '
                                   'connection with %s' % self.uri,
                                   backend=conn)

        if bind is not None:
            conn.simple_bind_s(bind, passwd)

        conn.active = True
github openstack / ldappool / ldappool / __init__.py View on Github external
# We successfully connected to one of the servers, so
            # we can just return the connection and stop processing
            # any additional URIs.
            if connected:
                return conn

        # We failed to connect to any of the servers,
        # so raise an appropriate exception.
        if not connected:
            if isinstance(exc, (ldap.NO_SUCH_OBJECT,
                                ldap.SERVER_DOWN,
                                ldap.TIMEOUT)):
                raise exc

        # that's something else
        raise BackendError(str(exc), backend=conn)

ldappool

A simple connector pool for python-ldap.

MPL-2.0
Latest version published 3 years ago

Package Health Score

46 / 100
Full package analysis