On Monday, December 16, 2013, Jeff James  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'm not really receiving an "exception" other than those three sites, out of the 30 or so I have listed, are the only sites which show "is down" at the end of that line specifying the site.</div>
<div dir="ltr"><br><div>
<br></div><div>Where " # " has been substituted for our domain name........<br><div><br></div><div><a href="https://my.#%23%23%23.com/intranet.html" target="_blank">https://my.####.com/intranet.html</a><b> is down</b></div>
<div>http://#####.main.####.com/psso/pssignsso.asp?dbname=FSPRD90<b> is down<br>
</b></div><div><a href="http://sharepoint.#%23%23%23.com/regions/west/PHX_NSC/default.aspx" target="_blank">http://sharepoint.####.com/regions/west/PHX_NSC/default.aspx</a><b> is down<br></b></div><div><b><br></b></div><div>
<b><br></b><div><br>
</div><div><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">Cc: <a href="javascript:_e({}, 'cvml', 'python-list@python.org');" target="_blank">python-list@python.org</a></span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">Date: Mon, 16 Dec 2013 06:54:48 -0500</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">Subject: Re: Question RE urllib</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">On Mon, Dec 16, 2013 at 6:40 AM, Jeff James <</span><a href="javascript:_e({}, 'cvml', 'jeff@jeffljames.com');" style="font-family:arial,sans-serif;font-size:12.800000190734863px" target="_blank">jeff@jeffljames.com</a><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> wrote:</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> So I'm using the following script to check our sites to make sure they are</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> all up and some of them are reporting they are "down" when, in fact, they</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> are actually up.   These sites do not require a logon in order for the home</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> page to come up.  Could this be due to some port being blocked internally ?</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> Only one of the sites reporting as down is "https" but all are internal</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> sites.  Is there some other component I should be including in the script ?</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> There are about 30 or 40 sites that I have listed in all.  I just use those</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> in the following script as examples.   Thanks</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">></span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> import urllib</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">></span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> sites = ["</span><a href="http://www.amazon.com/" style="font-family:arial,sans-serif;font-size:12.800000190734863px" target="_blank">http://www.amazon.com/</a><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">", "</span><a href="https://internalsite.com/intranet.html" style="font-family:arial,sans-serif;font-size:12.800000190734863px" target="_blank">https://internalsite.com/intranet.html</a><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">",</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> etc.]</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">></span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">> for site in sites:</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">>     try:</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">>         urllib.urlopen(site)</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">>         print site + " "</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<span style="font-family:arial,sans-serif;font-size:12.800000190734863px">>     except Exception, e:</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">>         print site + " is down"</span><br style="font-family:arial,sans-serif;font-size:12.800000190734863px">

<br style="font-family:arial,sans-serif;font-size:12.800000190734863px"><span style="font-family:arial,sans-serif;font-size:12.800000190734863px">In the handler print out the exception you are getting.</span><br></div></div>

</div></div></blockquote><div><br></div><div>If your exception handler is being called then you are indeed getting an exception. Add:</div><div><br></div><div>print str(e) </div><div><br></div><div>to the handler <span></span></div>