473,396 Members | 1,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

python ldap: what happens when ldap.initialize() is given a bad uri?

1
Greetings,

My ldap application relies on user input for a ldap server uri, so I am looking for a way to use the ldap api to determine whether the ldap server is up or not.
All the docs have to say is this:

initialize(uri)
Opens a new connection with an LDAP server, and return an LDAP object (see 1.1.4) used to perform operations on that server. Parameter uri has to be a valid LDAP URL.


Expand|Select|Wrap|Line Numbers
  1. server = "ldap://666.222.111.333"
  2. try:
  3.     l = ldap.initialize(server)
  4. except ldap.LDAPError, errorMsg:
  5.     print errorMsg
  6.  
When I run this code, no exception is raised, but there is clearly no ldap server running at that invalid ip address. If I try doing a bind afterwards, I can get an exception to be raised, but I have had unpredictable results in the amount of time (even using result()) that this takes.

Is initialize actually trying to make a connection?
If so, how can I find out if the connection failed without doing a bind?

I'm running python 2.4.2 on SUSE Linux Enterprise Desktop v. 10.
Apr 19 '07 #1
0 1709

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Brian Beck | last post by:
As far as I can tell, both maintainers of the Windows builds of Python-LDAP haven't updated in about a year. This doesn't exactly make the builds ancient or obsolete, but it would be nice to start...
1
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem...
1
by: Nico Grubert | last post by:
Hi there, on a linux machine I am running this ldapsearch from the command line: ldapsearch -x -h myldaphost.mydomain.com \ -D "CN=ldapuser,CN=Users,DC=mydomain,DC=com" -w "secret" \ -b...
0
by: sallas | last post by:
I am trying to connect to a Active Directory on a Windows server from either a Debian machine or a Windows XP machine using Python. So far I can connect using the following: import sys import...
6
by: hotani | last post by:
I am attempting to pull info from an LDAP server (Active Directory), but cannot specify an OU. In other words, I need to search users in all OU's, not a specific one. Here is what works: con...
2
by: theiviaxx | last post by:
Thanks for the help guys, it works! I used the ldap.set_option(ldap.OPT_REFERRALS, 0) from http://peeved.org/blog/2007/11/20/ immedialtey after import, then did the initialize trace_level=2 and...
2
by: Juan | last post by:
Hi I am trying to make a simple Python script using LDAP. The module is imported OK, but when I call the function open or initialize, I get this error: Traceback (most recent call last):...
1
by: Erick Perez - Quadrian Enterprises, S.A. | last post by:
Hi, I have a MS Windows AD domain, and have one OU with more tan 1000 users objects. When I try to read it, I hit the 1000 limit of AD while returning objects, so I'm asking for advice as to how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.