Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '16,': 0.03; 'jeff': 0.04; 'handler': 0.05; 'newbie': 0.05; 'subject:Question': 0.07; 'exception,': 0.09; 'exception.': 0.09; 'try:': 0.09; 'cc:addr :python-list': 0.11; '"is': 0.16; 'blocked': 0.16; 'guys,': 0.16; 'internally': 0.16; 'listed,': 0.16; 'logon': 0.16; 'specifying': 0.16; 'substituted': 0.16; 'url:my': 0.16; 'urllib': 0.16; 'when,': 0.16; 'component': 0.16; 'exception': 0.16; 'all.': 0.16; 'wrote:': 0.18; 'url:default': 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'print': 0.22; 'mon,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'reporting': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'url:mailman': 0.30; 'getting': 0.31; '"",': 0.31; 'sites.': 0.31; 'up.': 0.33; 'url:python': 0.33; 'could': 0.34; 'except': 0.35; 'skip:u 20': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'url:listinfo': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'should': 0.36; 'being': 0.38; 'url:amazon': 0.38; 'pm,': 0.38; 'sure': 0.39; 'called': 0.40; 'url:mail': 0.40; 'show': 0.63; 'our': 0.64; 'due': 0.66; 'home': 0.69; 'fact,': 0.69; 'url:asp': 0.77; 'add:': 0.84; 'etc.]': 0.84; 'examples.': 0.84; 'pain': 0.84; 'to:addr:jeff': 0.84; 'url:west': 0.84; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=4wzS72iOTw/RMli+GORjEsxUW7QLfvq7fMrZH+j2GZQ=; b=rfCdehYu8gcO4TL93eLV7nm7mzsZmEi5mPfutOCcFab6Koh2O1pKjRzB8REYwmnV20 OFdClm7zS7HKorZ4Mf561cMhQZ9sxJjDcUOi7AQfV+nCPEvkFnd/Ja9/9k2vbBs80dh2 yBSzjtviuXNle6bpL2SKjHz+KhYBCFKWP3NxK7pP1QRzM6qJW1UykMMnx5AMX469GpmG 3HQjTkClGPCs3Q9Pn0Qz26t8uDNDJfneXl3nRS5u3VNgYa79/heCmGlweGBnPhvWAu/P s0PrZuMZz6bos9sCX6DedUDWyrKIhVLroEt4CZc6pyJqsNiCHMYffB6Ji9QmzZ1s6pci x9Bw== MIME-Version: 1.0 X-Received: by 10.194.219.1 with SMTP id pk1mr15525613wjc.36.1387223826007; Mon, 16 Dec 2013 11:57:06 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Dec 2013 14:57:05 -0500 Subject: Re: Question RE urllib From: Larry Martell To: Jeff James Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 66 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387223829 news.xs4all.nl 2890 [2001:888:2000:d::a6]:42592 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62097 On Mon, Dec 16, 2013 at 2:55 PM, Jeff James wrote: > 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) " ? The line after the print site + " is down" line. > > 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 is down >> http://#####.main.####.com/psso/pssignsso.asp?dbname=FSPRD90 is down >> http://sharepoint.####.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 > > -- > https://mail.python.org/mailman/listinfo/python-list >