473,378 Members | 1,346 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,378 software developers and data experts.

how best to handle httplib timeouts ?

Hi all,

I'm trying to write an app to monitor an IIS server, by connecting and
getting a page via httplib. the problem seems to be when IIS (or ASP) dies
httplib does not always return and sometimes I'm left with an app that
hangs. what is the best way to handle this ?

thanks,
rich.

the code looks like this:

try:
res = h.getresponse()
dat = res.read()
sFlag = sFlag + 1
except:
if debug > 0:
WriteLog(' Error receiving a response from 2nd mailbox page
request')
h.close()
return sFlag

Jul 18 '05 #1
3 2056

rich> I'm trying to write an app to monitor an IIS server, .... what is
rich> the best way to handle this ?

Off-topic response perhaps, but if you want to monitor services running on
remote machines, you should see what's already available. I use Nagios,
<http://www.nagios.org/>, and find it excellent for the purpose (a bit
complex to get started with, but very robust).

Skip

Jul 18 '05 #2

"Skip Montanaro" <sk**@pobox.com> wrote in message
news:ma**********************************@python.o rg...

Off-topic response perhaps, but if you want to monitor services running on
remote machines, you should see what's already available. I use Nagios,
<http://www.nagios.org/>, and find it excellent for the purpose (a bit
complex to get started with, but very robust).

Skip

Thanks Skip,
Monitoring services themselves is a snap but I'm trying to monitor the state
of IIS, and in particular the state of OWA running on IIS. OWA for Exchange
5.5 is a bit flakey at best and it doesn't always show up as a service
outage. The script I have so far connects to the server (using HTTPS) then
passes a login request for a mailbox and retrieves the Inbox page. It does 5
different requests in all and sometimes gets stuck on the third or fourth
request. Running the source code version seems a little better than the one
compiled with py2exe, and it will often return after what seems like a 2
minute socket timeout. I've also tried playing with different settings for
the default socket timeout value but that doesn't seem to help either. (I'm
running 2.3b2)

thanks,

rich.
Jul 18 '05 #3

"John J. Lee" <jj*@pobox.com> wrote in message
news:87************@pobox.com...
[snip]
1. Get 2.3final (I don't know whether there was a bug fix, but I have
a vague recollection there was some sort of problem with timeouts
-- see the python-dev summaries and/or SF bug archive).


yes, this seems to have made the problem go away... I tried setting the
default timeout but it still acted flakey and would not connect, so, I
removed this and everything seems to be working, or at lest timing out
correctly.

2.3final also solved the "ImportError: No module named warnings" problem
with py2exe and I think this may have had something to do with it.

thanks,
rich.
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Shagshag | last post by:
hello, how can i set multiple cookies like : Set-Cookie: cookiename1=value1; expires=Tue, 31-Mar-09 11:17:43 GMT; path=/; domain=www.domain.com Set-Cookie: cookiename2=value2; expires=Tue,...
0
by: Milos Prudek | last post by:
How can I set httplib timeout for httplib.request() ? httplib.request timeouts after 3:10 with "socket" timeout error message. I found socket.settimeout() and I believe there is a way to add...
1
by: Brian Beck | last post by:
Hi. I'm having some problems with code based directly on the following httplib documentation code: http://www.zvon.org/other/python/doc21/lib/httplib-examples.html I've included the code and...
0
by: Robert | last post by:
did you solve this problem? It seems to be still present here with py2.3.5. Robert -- From: Manish Jethani <manish.j@gmx.net> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US;...
0
by: Michael Ekstrand | last post by:
In the course of my current project, I've had to deal with connecting to an HTTP server that isn't fully compliant with the HTTP requirements for chunked encodings. Rather than sending the...
4
by: Sandy | last post by:
Hello - I read an interesting article on the web wherein the author states he doesn't handle too many errors at page level, but handles them at the application level. He further goes on to show...
4
by: Patrick Altman | last post by:
I am attempting to use a HEAD request against Amazon S3 to check whether a file exists or not and if it does parse the md5 hash from the ETag in the response to verify the contents of the file so...
2
by: Joannes Vermorel | last post by:
We have developed an open-source eCommerce sales forecasting add-on in PHP (see link below) that requires usually more than a few seconds to complete because the process involves some Web Services...
3
by: rhXX | last post by:
hi all, i'm using this tutorial example import httplib h = httplib.HTTP("www.python.org") h.putrequest('GET','/index.html') h.putheader('User-Agent','Lame Tutorial Code')...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.