Python ldap3绑定无法转换';诺瓦卢';对象到字节
运行python3.6Python ldap3绑定无法转换';诺瓦卢';对象到字节,python,ldap,openldap,ldap3,Python,Ldap,Openldap,Ldap3,运行python3.6 ldap3 python库 在docker容器上使用OpenLDAP/docker OpenLDAP 端口389和636打开。我可以从python中看到控制台中的连接;但是,我遇到了一些问题。 在主机上的jupyter笔记本上运行python 我似乎无法让康妮·班德(康妮·班德)工作。这是我的密码: from ldap3 import Connection, Server, ALL server = Server('127.0.0.1') conn = Connect
ldap3 python库
在docker容器上使用OpenLDAP/docker OpenLDAP
端口389和636打开。我可以从python中看到控制台中的连接;但是,我遇到了一些问题。
在主机上的jupyter笔记本上运行python 我似乎无法让康妮·班德(康妮·班德)工作。这是我的密码:
from ldap3 import Connection, Server, ALL
server = Server('127.0.0.1')
conn = Connection(server, user='cn=admin,dc=example,dc=org',
password="admin")
conn.open()
conn.bind()
以下是错误:
>-------------------------------------------------------------------------->-
>TypeError Traceback (most recent call last)
><ipython-input-3-5c5644694a2b> in <module>()
2 conn = Connection(server, user='cn=admin,dc=example,dc=org', password="admin")
3 conn.open()
----> 4 conn.bind()
>~/anaconda3/lib/python3.6/site-packages/ldap3/core/connection.py in bind(self, read_server_info, controls)
425 if log_enabled(PROTOCOL):
426 log(PROTOCOL, 'simple BIND request <%s> sent via <%s>', bind_request_to_dict(request), self)
--> 427 response = self.post_send_single_response(self.send('bindRequest', request, controls))
428 elif self.authentication == SASL:
429 if self.sasl_mechanism in SASL_AVAILABLE_MECHANISMS:
>~/anaconda3/lib/python3.6/site-packages/ldap3/strategy/sync.py in post_send_single_response(self, message_id)
120 Returns the result message or None
121 """
--> 122 responses, result = self.get_response(message_id)
123 self.connection.result = result
124 if result['type'] == 'intermediateResponse': # checks that all responses are intermediates (there should be only one)
>~/anaconda3/lib/python3.6/site-packages/ldap3/strategy/base.py in get_response(self, message_id, timeout)
296 if self._outstanding and message_id in self._outstanding:
297 while timeout >= 0: # waiting for completed message to appear in responses
--> 298 responses = self._get_response(message_id)
299 if not responses:
300 sleep(RESPONSE_SLEEPTIME)
>~/anaconda3/lib/python3.6/site-packages/ldap3/strategy/sync.py in _get_response(self, message_id)
166 log(EXTENDED, 'ldap message received via <%s>:%s', self.connection, format_ldap_message(ldap_resp, '<<'))
167 if int(ldap_resp['messageID']) == message_id:
--> 168 dict_response = self.decode_response(ldap_resp)
169 ldap_responses.append(dict_response)
170 if dict_response['type'] not in ['searchResEntry', 'searchResRef', 'intermediateResponse']:
>~/anaconda3/lib/python3.6/site-packages/ldap3/strategy/base.py in decode_response(self, ldap_message)
401 if message_type == 'bindResponse':
402 if not bytes(component['matchedDN']).startswith(b'NTLM'): # patch for microsoft ntlm authentication
--> 403 result = bind_response_to_dict(component)
404 else:
405 result = sicily_bind_response_to_dict(component)
>~/anaconda3/lib/python3.6/site-packages/ldap3/operation/bind.py in bind_response_to_dict(response)
117 'message': str(response['diagnosticMessage']),
118 'referrals': referrals_to_list(response['referral']),
--> 119 'saslCreds': bytes(response['serverSaslCreds']) if response['serverSaslCreds'] is not None else None}
120
121
>~/anaconda3/lib/python3.6/site-packages/pyasn1/type/univ.py in __bytes__(self)
888
889 def __bytes__(self):
--> 890 return bytes(self._value)
891
892 def asOctets(self):
>TypeError: cannot convert 'NoValue' object to bytes
------------------------------------------------------------------------------------->-
>TypeError回溯(最近一次调用上次)
>在()
2 conn=Connection(服务器,user='cn=admin,dc=example,dc=org',password=“admin”)
3康涅狄格开放式酒店
---->4康涅狄格州邦德
>绑定中的~/anaconda3/lib/python3.6/site-packages/ldap3/core/connection.py(self,读取服务器信息,控件)
425如果已启用日志(协议):
426日志(协议,“通过发送的简单绑定请求”,将请求绑定到dict(请求),self)
-->427 response=self.post\u send\u single\u response(self.send('bindRequest',request,controls))
428 elif自我验证==SASL:
429如果sasl_中的self.sasl_机制可用_机制:
>post\u send\u single\u响应中的~/anaconda3/lib/python3.6/site-packages/ldap3/strategy/sync.py(self,message\u id)
120返回结果消息或无
121 """
-->122响应,结果=self.get\u响应(消息\u id)
123 self.connection.result=结果
124如果结果['type']='intermediateResponse':#检查所有响应是否都是中间响应(应该只有一个)
>获取响应中的~/anaconda3/lib/python3.6/site-packages/ldap3/strategy/base.py(self、message\u id、超时)
296如果self.\u未完成和self.\u未完成中的消息id:
297超时>=0时:#等待已完成的消息出现在响应中
-->298响应=自我获取响应(消息id)
299如果没有答复:
300睡眠时间(响应时间)
>~/anaconda3/lib/python3.6/site-packages/ldap3/strategy/sync.py in\u get\u response(self,message\u id)
166日志(扩展,“通过%s接收ldap消息”,self.connection,格式化ldap消息(ldap_resp),尝试更新最新的ldap3和pyasn1版本。这起作用。pyasn1-0.3.2和ldap3-2.3中出现此症状,但在pyasn1-0.4.2和ldap3-2.4.1中正常工作。