Connection Examples - adeutscher/DirectoryTools GitHub Wiki
To connect to a server via Global Catalog (TCP/3268) using your configuration in a separate file, create a .ini file like so:
[DirectoryTools] server.address='sandbox.lan' server.port='3268' server.ssl=False dir.base'dc=sandbox,dc=lan' user.user='CN=Proxy User,CN=Users,DC=sandbox,DC=lan' user.password='swordfish' log.level=50In Python, this would be loaded like so:
import DirectoryTools dt = DirectoryTools.DirectoryTools(False,'ad','path/to/my/config.ini')Alternately, this can be loaded after the fact like so:
dt.loadConfigFile('path/to/my/config.ini')
To connect to a server via Global Catalog using only variables defined in your Python code:
properties = { indexes.BASE_DN:'dc=sandbox,dc=lan', indexes.SERVER_ADDRESS:'sandbox.lan', indexes.SERVER_PORT:'3268', indexes.USE_SSL:False, indexes.PROXY_USER:'CN=Proxy User,CN=Users,DC=sandbox,DC=lan', indexes.PROXY_PASSWORD:'swordfish', indexes.LOG_LEVEL:DirectoryTools.LOG_LEVEL_CRITICAL, }