使用LDAP身份验证下载文件

时间:2017-01-09 18:25:40

标签: python-2.7 spyder python-ldap

我试图找到一种从需要LDAP身份验证的网络URI (非网络)下载CSV的方法。我有一个服务帐户,但我找不到可行的解决方案:

conn = ldap.open("10.41.10.10:389") #I've tried different URIs
conn.simple_bind_s('svc_acct@company.com', 'password')       
call = open(r'\\fserv03\reports\gps_List.csv')

有更好的方法吗?

更新:在下载Python-LDAP工作后让Python-LDAP用于我的64位安装,我下载了python_ldap-2.4.28-cp27-cp27m-win_amd64并在其上运行pip install。

1 个答案:

答案 0 :(得分:0)

我能够使用以下内容(使用Python-LDAP库):

try:
    l = ldap.initialize('ldap://LDAP SERVER HERE')
    l.protocol_version = ldap.VERSION2
    username = "cn=USER, o=example.com"
    password = 'PASSWORD HERE'
    l.simple_bind(username, password)
except ldap.LDAPError, e:
    print e