ldappr/ldappr/api.py

14 lines
332 B
Python
Raw Normal View History

2014-09-16 14:36:33 +04:00
import sys
import ldap
2014-09-14 17:24:19 +04:00
from connection import Connection, AuthConnection
def connect_to(server, *args, **kwargs):
2014-09-16 14:36:33 +04:00
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)