import ldap import toml import sys def init_ldap(server, user, pw): con = ldap.initialize(server) con.simple_bind_s(user, pw) return con if __name__ == '__main__': server = sys.argv[1] user = sys.argv[2] pw = sys.argv[3] con = init_ldap(server, user, pw) result = con.search_s('dc=beuth-hochschule,dc=de', ldap.SCOPE_SUBTREE, '|(title=Mechatronik Bachelor)(title=Mechatronik Master)', ['cn'])