RE: urllib and authentication script integration
I have some simple code I would like to share with someone that can assist me in integrating authentication script into. I'm sure it's an easy answer for any of you. I am still researching, but on this particular project, time is of the essence and this is the only missing piece of the puzzle for the completion of this script. I know all of you are busy, but if anyone has some time for me to send them what I have, I'd rather not share it on the public forum. Thanks -- https://mail.python.org/mailman/listinfo/python-list
RE: Use of urllib (update)
Folks, I promise I'll get to the point where my questions aren't so basic, but I'm just now starting to get into Python. So I'm using the urllib script to check to make sure our company sites are up. As stated earlier, I have three sites which require some form of authentication in order to report back through the script that they are up and accessible.I was given this very helpful link by Larry covering some authentication code I could implement into the script. http://docs.python.org/2.7/howto/urllib2.html#id6 .I can make out the logic behind the script, but because I'm still new to Python, I'm having a hard time trying to figure out how to implement it into my existing urllib script. I'm assuming I need to integrate the code somehow for each url requiring authentication in that each site requires different creds... Other than this little speedbump this script is pretty slick and has already scored a few points with my manager. ;o) Thanks -- https://mail.python.org/mailman/listinfo/python-list
RE: Question RE urllib
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 -- https://mail.python.org/mailman/listinfo/python-list I've never used urllib, although I've done a fair amount of network programming at lower levels. Are you sure the report of down isn't simply a time out due to the server being busier than you expect when you hit it? -Bill After adding the line suggested by Larry, I was able to determine that the URLs reporting as down were actually sites requiring authentication in order to provide site content, so adding that line to the handler was at least enlightening in that respect. Thanks Larry. -- https://mail.python.org/mailman/listinfo/python-list
Question RE urllib
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 -- https://mail.python.org/mailman/listinfo/python-list
Re: Question Re urllib (Jeff James)
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* Cc: python-list@python.org Date: Mon, 16 Dec 2013 06:54:48 -0500 Subject: Re: Question RE urllib On Mon, Dec 16, 2013 at 6:40 AM, Jeff James j...@jeffljames.com 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. -- https://mail.python.org/mailman/listinfo/python-list
RE: Question RE urllib
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.htmlhttps://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.aspxhttp://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 -- https://mail.python.org/mailman/listinfo/python-list
Re: Question Re urllib (Resolved)
This worked perfectly. Thank You Where, exactly in the script would I place the print str(e) ? The line after the print site + is down line. Original Post : 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.aspxhttp://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. -- https://mail.python.org/mailman/listinfo/python-list
Script Request
Looking for a script which will check connectivity of any or all of our company URL's first thing in the morning to make sure none or our sites are down. Any suggestions ? Thank You -- https://mail.python.org/mailman/listinfo/python-list