python - 使用 python ldap3 模块搜索具有“uid”的用户时出现此错误
问题描述
使用 python ldap3 模块搜索具有“uid”的用户时出现此错误
错误:
Traceback (most recent call last):
File "/Users/robinmalhotra/PycharmProjects/pythonProject/main.py", line 6, in <module>
print(c.extend.standard.who_am_i())
File "/Users/robinmalhotra/.local/share/virtualenvs/pythonProject-AY4VAyDV/lib/python3.9/site-packages/ldap3/extend/__init__.py", line 65, in who_am_i
return WhoAmI(self._connection,
File "/Users/robinmalhotra/.local/share/virtualenvs/pythonProject-AY4VAyDV/lib/python3.9/site-packages/ldap3/extend/operation.py", line 53, in send
resp = self.connection.extended(self.request_name, self.request_value, self.controls)
File "/Users/robinmalhotra/.local/share/virtualenvs/pythonProject-AY4VAyDV/lib/python3.9/site-packages/ldap3/core/connection.py", line 1275, in extended
response = self.post_send_single_response(self.send('extendedReq', request, controls))
File "/Users/robinmalhotra/.local/share/virtualenvs/pythonProject-AY4VAyDV/lib/python3.9/site-packages/ldap3/strategy/base.py", line 336, in send
raise LDAPSocketOpenError(self.connection.last_error)
ldap3.core.exceptions.LDAPSocketOpenError: unable to send message, socket is not open
这是我的脚本:
from ldap3 import Server, Connection, ALL
s = Server(host='oimdevsand', port=389, use_ssl=False, get_info='ALL')
c = Connection(s, user='uid=idmsa,ou=People,ou=auth,o=ABX', password='XYZ', auto_bind='NONE', version=3, authentication='SIMPLE', \
client_strategy='SYNC', auto_referrals=True, check_names=True, read_only=False, lazy=False, raise_exceptions=False)
print(c.extend.standard.who_am_i())
c.search("ABC","o=abc","(uid=abc)")
print(c.entries)
解决方案
推荐阅读
- keras - 由于 Keras 变量名称未出现在摘要中,如何通过名称访问回调或其他地方的 Keras 变量?
- excel - 延期预约的原“开始日期”
- python - Python & clang:try...except 语句不适用于分段错误(核心转储)
- c# - 在 TransactionScope 上为数据库连接启用 SSL 时出错
- batch-file - vbscript 在 wmplayer 中打开 mp4,但只播放音频
- excel - 交互式文本框选择取消时如何取消案例
- spring - Response 实体中 replaceAll(Response) 的替换是什么?
- php - Ajax 只返回一个值,但我需要它来返回属于一种条件的所有值
- apache-spark - 从段落重新启动 Apache Zeppelin 解释器
- mysql - 无法连接到 GCP 上的云 sql