小编Fra*_*orn的帖子

Python ldap3 LDAPSocketOpenError无法发送消息,socket未打开

我在Python编写代码,ldap3试图在CentOS上的OpenLDAP中创建用户.我的本地开发机器运行的是Windows 8 64位.以下是我的代码.

from ldap3 import Server, Connection, ALL

# define the server
s = Server('ldap://ldap.abcd.com:389', get_info=ALL)  

# define the connection
c = Connection(s, user='cn=Manager,dc=mydomain,dc=com', password='Super1')

# perform the Add operation
c.add('uid=user3,ou=People,dc=abcd,dc=com',['person','organizationalPerson','inetOrgPerson', 'posixGroup', 'top','shadowAccount'], {'givenName': 'user3firstname','sn': 'user3lastname', 'uidNumber' : 520,'gidNumber' : 521,'uid': 'user3','cn': 'user3user3lastname'})

# close the connection
c.unbind()
Run Code Online (Sandbox Code Playgroud)

Server和Connection类工作正常.我想因为如果我只运行那2个语句,它就不会产生下面的错误.

LDAPSocketOpenError at /adminservice/users/
unable to send message, socket is not open
Request Method: GET
Request URL:    http://127.0.0.1:8000/adminservice/users/
Django Version: 1.8.4
Exception Type: LDAPSocketOpenError
Exception Value:    
unable to send message, socket …
Run Code Online (Sandbox Code Playgroud)

python windows ldap centos openldap

4
推荐指数
1
解决办法
4835
查看次数

标签 统计

centos ×1

ldap ×1

openldap ×1

python ×1

windows ×1