|
From: <Ric...@ju...> - 2002-09-26 12:19:11
|
I have version ldap-1.10a3 installed. I am running on a python 2.2 on a
win2000 system.
I have been unable to make the search work. Below are some of my
unsuccessful tries. Can I use the "_s" option on the version that I am
running and if not, can anyone tell me what format I would use for a basic
search that returns the attributes I am looking for ? I assume that once I
get this, the modify of the object would have the same format.
Is this the version that would be used for win2000 ?
Thanks,
Richard Ferry
-------------------------------------------
import ldap
l = ldap.open("myserver.myorg:4444")
l.simple_bind_s('uid=xxxxx,ou=myou,o=myorg','xxxxx')
res = l.search_s('o=myorg', ldap.SCOPE_BASE, 'uid=xxxxx,ou=myou,o=myorg',
["ou", "l"])
When using the synchronous call I get this error:
Traceback (most recent call last):
File "C:\Python22\test_ld1.py", line 3, in ?
l.simple_bind_s('uid=xxxxx,ou=myou,o=myorg','xxxxx')
LOCAL_ERROR: {'desc': 'Local error'}
-------------------------------------
import ldap
l = ldap.open("myserver.myorg:4444")
l.simple_bind('uid=xxxxx,ou=myou,o=myorg','xxxxx')
res = l.search('o=myorg', ldap.SCOPE_BASE, 'uid=xxxxx,ou=myou,o=myorg',
["ou", "l"])
for entry in res:
attrs=entry[1]
ou=attrs["ou"]
loc=attrs["l"]
print loc
print ou
l.unbind()
This code gives me this error msg: TypeError: iteration over non-sequence
--------------------------------------------
import ldap
l = ldap.open("myserver.myorg:4444")
l.simple_bind('uid=xxxxx,ou=myou,o=myorg','xxxxx')
res = l.search('o=myorg', ldap.SCOPE_BASE, 'uid=xxxxx,ou=myou,o=myorg',
["ou", "l"])
print res
This code prints out res, which has a value of 2. |