diff --git a/ldappr/api.py b/ldappr/api.py index 294c9bf..12e9804 100644 --- a/ldappr/api.py +++ b/ldappr/api.py @@ -1,8 +1,13 @@ +import sys +import ldap from connection import Connection, AuthConnection def connect_to(server, *args, **kwargs): - if args or 'bind_dn' and 'password' in kwargs: - #if args: - return AuthConnection(server, *args, **kwargs) - return Connection(server, **kwargs) + try: + if args or 'bind_dn' and 'password' in kwargs: + return AuthConnection(server, *args, **kwargs) + return Connection(server, **kwargs) + except Exception as e: + print str(e) +