Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62096 > unrolled thread
| Started by | Jeff James <jeff@jeffljames.com> |
|---|---|
| First post | 2013-12-16 12:55 -0700 |
| Last post | 2013-12-16 20:58 +0000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
RE: Question RE urllib Jeff James <jeff@jeffljames.com> - 2013-12-16 12:55 -0700
Re: Question RE urllib John Gordon <gordon@panix.com> - 2013-12-16 20:58 +0000
| From | Jeff James <jeff@jeffljames.com> |
|---|---|
| Date | 2013-12-16 12:55 -0700 |
| Subject | RE: Question RE urllib |
| Message-ID | <mailman.4234.1387223734.18130.python-list@python.org> |
[Multipart message — attachments visible in raw view] — view raw
Sorry to be a pain here, guys, as I'm also a newbie at this as well. Where, exactly in the script would I place the " print str(e) " ? Thanks Original message : 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. > > Where " # " has been substituted for our domain name........ > > https://my.####.com/intranet.html<https://my./#%23%23%23.com/intranet.html>* is > down* > http://#####.main.####.com/psso/pssignsso.asp?dbname=FSPRD90 > * is down* > http://sharepoint.####.com/regions/west/PHX_NSC/default.aspx<http://sharepoint./#%23%23%23.com/regions/west/PHX_NSC/default.aspx> > * is down* > > > > > So I'm using the following script to check our sites to make sure they > are > > all up and some of them are reporting they are "down" when, in fact, they > > are actually up. These sites do not require a logon in order for the > home > > page to come up. Could this be due to some port being blocked > internally ? > > Only one of the sites reporting as down is "https" but all are internal > > sites. Is there some other component I should be including in the > script ? > > There are about 30 or 40 sites that I have listed in all. I just use > those > > in the following script as examples. Thanks > > > > import urllib > > > > sites = ["http://www.amazon.com/", " > https://internalsite.com/intranet.html", > > etc.] > > > > for site in sites: > > try: > > urllib.urlopen(site) > > print site + " " > > except Exception, e: > > print site + " is down" > > In the handler print out the exception you are getting. > If your exception handler is being called then you are indeed getting an exception. Add: print str(e) to the handler
[toc] | [next] | [standalone]
| From | John Gordon <gordon@panix.com> |
|---|---|
| Date | 2013-12-16 20:58 +0000 |
| Message-ID | <l8npgp$1go$1@reader1.panix.com> |
| In reply to | #62096 |
In <mailman.4234.1387223734.18130.python-list@python.org> Jeff James <jeff@jeffljames.com> writes:
> --f46d04479f936227ee04edac31bd
> Content-Type: text/plain; charset=ISO-8859-1
> Sorry to be a pain here, guys, as I'm also a newbie at this as well.
> Where, exactly in the script would I place the " print str(e) " ?
except Exception, e:
print site + " is down"
print str(e)
--
John Gordon Imagine what it must be like for a real medical doctor to
gordon@panix.com watch 'House', or a real serial killer to watch 'Dexter'.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web