2014-09-16 14:36:33 +04:00
|
|
|
import sys
|
|
|
|
import ldap
|
2018-04-26 12:51:29 +03:00
|
|
|
from .connection import Connection, AuthConnection
|
2014-09-14 17:24:19 +04:00
|
|
|
|
|
|
|
|
|
|
|
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:
|
2018-04-26 12:51:29 +03:00
|
|
|
print(str(e))
|
2014-09-16 14:36:33 +04:00
|
|
|
|