Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.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.034 X-Spam-Evidence: '*H*': 0.93; '*S*': 0.00; 'subject:Question': 0.07; 'exception,': 0.09; 'try:': 0.09; 'blocked': 0.16; 'e:\xa0': 0.16; 'internally': 0.16; 'logon': 0.16; 'urllib': 0.16; 'when,': 0.16; 'component': 0.16; 'all.': 0.16; 'sender:addr:gmail.com': 0.17; '8bit%:5': 0.22; 'import': 0.22; 'print': 0.22; 'script': 0.25; 'reporting': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; '"",': 0.31; '"': 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; 'skip:& 10': 0.38; 'url:amazon': 0.38; 'skip:[ 10': 0.38; 'to:addr:python-list': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'our': 0.64; 'due': 0.66; 'home': 0.69; 'fact,': 0.69; 'etc.]': 0.84; 'examples.': 0.84; '\xa0there': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:date:message-id:subject:from:to:content-type; bh=96IG1cRkFW4RB/307oE62j9VO+YO650Mbl6NPedDLLs=; b=JekSsEpKzUtFRQoqoxtbo8biYehAAowxrmK9poKfrZGGIGT+Qnd5JsN0beD3BEryIJ xx0S9eOBpu0uxsoxPeU1MEHWiEfbgSwQ7rSIeIOBWOvUX2VFBbsGgnapAO58rTGMDsig A3QDk6x5evCNlawKE7t56/AkAQrXrMQkoEKbpODgGCR+Zf1LYOSPM0ltu5+E1LY7gc4w DnmPM+lQOfQbGfj0+OHhynMlqGX/VP5szrWUiuGI7LR77um+rVp6evIwYjGh/Km+7MFN DWvTZw4NYL//dZgVc5lxaki21o4Psn91wOY474kG5RMLGLgbK0DjUMW5FHJIuD8KPsOk kRMA== MIME-Version: 1.0 X-Received: by 10.182.29.66 with SMTP id i2mr11077579obh.23.1387194053161; Mon, 16 Dec 2013 03:40:53 -0800 (PST) Sender: jljames@gmail.com Date: Mon, 16 Dec 2013 04:40:53 -0700 X-Google-Sender-Auth: CMasujuBKRXHG2x4-r84-mt0u0w Subject: Question RE urllib From: Jeff James To: python-list@python.org Content-Type: multipart/alternative; boundary=001a11c2bbdcc5f84d04eda54835 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: 48 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387194518 news.xs4all.nl 2840 [2001:888:2000:d::a6]:34780 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62048 --001a11c2bbdcc5f84d04eda54835 Content-Type: text/plain; charset=ISO-8859-1 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" --001a11c2bbdcc5f84d04eda54835 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
So I'm using the following script to check our sites t= o make sure they are all up and some of them are reporting they are "d= own" when, in fact, they are actually up. =A0 These sites do not requi= re a logon in order for the home page to come up. =A0Could this be due to s= ome port being blocked internally ? =A0Only one of the sites reporting as d= own is "https" but all are internal sites. =A0Is there some other= component I should be including in the script ? =A0There are about 30 or 4= 0 sites that I have listed in all. =A0I just use those in the following scr= ipt as examples. =A0 Thanks

import urllib


for site in sites:
=A0 =A0 try:
=A0= =A0 =A0 =A0 urllib.urlopen(site)
=A0 =A0 =A0 =A0 print site + &q= uot; "
=A0 =A0 except Exception, e:
=A0 =A0 =A0 = =A0 print site + " is down"
--001a11c2bbdcc5f84d04eda54835--