Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62096

RE: Question RE urllib

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <jljames@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.012
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'handler': 0.05; 'newbie': 0.05; 'subject:Question': 0.07; 'exception,': 0.09; 'exception.': 0.09; 'try:': 0.09; '"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; 'sender:addr:gmail.com': 0.17; 'url:default': 0.19; 'import': 0.22; 'print': 0.22; 'script': 0.25; '&gt;': 0.26; 'reporting': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'getting': 0.31; '&quot;': 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; 'really': 0.36; '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; 'skip:& 20': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'show': 0.63; 'our': 0.64; 'due': 0.66; 'home': 0.69; 'fact,': 0.69; 'url:%1': 0.72; 'url:asp': 0.77; 'add:': 0.84; 'etc.]': 0.84; 'examples.': 0.84; 'pain': 0.84; 'url:west': 0.84; '<>*': 0.95
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=e+Nm35954iSpLhjuLEtqoSOi8kHrmqISpgKHmN6Jk9c=; b=PZUxY7uZBrmZAbbLwIaM0PUaucsYqXKS/bw7hr6KhW24f4H9blHdiurZoIZrByslKK cguhe/ENhG1LlfG6kizQNLklE9qo1j37IoNSy1JVOKFEtPyeBcLxAQ08CjwUaJmKodtY JosmrVp3K+ztC7HfutCvlyLrXCD9tUFf6GLHfCAOPNnjn2WqRU030BuYdfkobT3O+zmY xL/d3RGmBeQXRxenxGXhptMLATNQ3Z41KhiSDsiR47gIe+sEyP3YgUpLkO6m9qwGla0z JuXsEgiT6xLEJ1PGv/aQKB/XixFBowPp0rBFm9lFmVvvAr+RzneddhiEGRfMrTt/JjJL wxzA==
MIME-Version 1.0
X-Received by 10.182.16.33 with SMTP id c1mr13138184obd.4.1387223725514; Mon, 16 Dec 2013 11:55:25 -0800 (PST)
Sender jljames@gmail.com
Date Mon, 16 Dec 2013 12:55:25 -0700
X-Google-Sender-Auth DE8Kq01u-08Pr42iFv4s6sKY-3M
Subject RE: Question RE urllib
From Jeff James <jeff@jeffljames.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=f46d04479f936227ee04edac31bd
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4234.1387223734.18130.python-list@python.org> (permalink)
Lines 127
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387223737 news.xs4all.nl 2843 [2001:888:2000:d::a6]:40753
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62096

Show key headers only | View raw


[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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

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

csiph-web