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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '16,': 0.03; 'jeff': 0.04; 'handler': 0.05; 'subject:Question': 0.07; 'exception,': 0.09; 'try:': 0.09; 'cc:addr:python-list': 0.11; 'blocked': 0.16; 'internally': 0.16; 'logon': 0.16; 'urllib': 0.16; 'when,': 0.16; 'component': 0.16; 'exception': 0.16; 'all.': 0.16; 'wrote:': 0.18; '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; 'am,': 0.29; 'reporting': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '"",': 0.31; 'sites.': 0.31; 'up.': 0.33; 'could': 0.34; 'except': 0.35; 'skip:u 20': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'thanks': 0.36; 'should': 0.36; 'being': 0.38; 'url:amazon': 0.38; 'sure': 0.39; 'our': 0.64; 'due': 0.66; 'home': 0.69; 'fact,': 0.69; 'etc.]': 0.84; 'examples.': 0.84; 'to:addr:jeff': 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=4zfxyi5gfWYzYqDQBGaGBolKAvd1c+0C2Hbo0IPVJXQ=; b=PufVPLa8zeqRCGiipJQGl/+qOWvZkH0AksWnGW0PRJ0RO91DjEY0410bdz8CvYo2TW WtY40bxj9FkI5olDZeBN1Icyqkf9WEVqmXeGcWg796rPMPRAThCh6ALqKGsnhYzIBO4c /730E2l45cFK67Ht2auV+u4t63KDYVH6sB/UB9rFiEEFcyFnwOULttoWxpy+M0QPd3Yi nA2I75el6NSI9CY9rgqQL8U/LLJcduloSPhmI8PO0AQkbFV86J+0ultsWIHzvWCe9CqQ 5cQ9EsF/yUAeGOE3jK88qV8C8AzdZO2eBdTfy4Ulcw+TZPquTNntOD0JCXkhlDyFsmGH 636w== MIME-Version: 1.0 X-Received: by 10.194.82.68 with SMTP id g4mr1569878wjy.85.1387194888101; Mon, 16 Dec 2013 03:54:48 -0800 (PST) In-Reply-To: References: Date: Mon, 16 Dec 2013 06:54:48 -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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387194895 news.xs4all.nl 2838 [2001:888:2000:d::a6]:37362 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62049 On Mon, Dec 16, 2013 at 6:40 AM, Jeff James wrote: > 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.