Python Ldap模块将搜索限制为1000个用户,如何使用简单搜索?

时间:2019-04-11 02:50:27

标签: python ldap3

我在python中使用Ldap3模块查询广告,但是如果广告帐户在前1000次搜索中得到结果,我在广告中有超过25000 +用户ID,如何在此处将代码更改为简单页面搜索,请帮助我。

''''

import sys
from ldap3 import Server, Connection, ALL, NTLM, ALL_ATTRIBUTES, ALL_OPERATIONAL_ATTRIBUTES, AUTO_BIND_NO_TLS, SUBTREE
from ldap3.core.exceptions import LDAPCursorError


server = Server('bluepedia.com',get_info=ALL)
conn = Connection(server, user='bluepedia\\administrator', password='Vihaan@2016', authentication=NTLM)
conn.bind()
fusers = ['vihaan','phani','rammohan','raja','bindu','MA977956', 'MA625841','gopal','govind','MA177397','MA259156']
status = ''
usermail= ''

format_string = '{:25} {:21} {}'
print(format_string.format('User ID', 'Account Status', 'E-mail Address'))

conn.search('dc=bluepedia,dc=com', '(objectclass=person)',attributes=['sAMAccountName', 'mail'])

for x in fusers:
    for e in conn.entries:
        usermail = e.mail
        if x in e.sAMAccountName:
            # status = 'active' +"\t\t\t\t"+ str(usermail)
            status = 'active'
            break
        else:
            status = "Not Active"
        usermail = ''
    print(format_string.format(str(x),str(status),str(usermail)))

''''

我所需的结果是我想使用Ldap3模块从列表中搜索用户ID,并且列表中有10000个用户。

0 个答案:

没有答案
相关问题