473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Re: Testing for connection to a website


Fredrik Lundh wrote:
>
Alexnb wrote:
>e = ''
>try:
...
except HTTPError, e:
print e.code
except URLError, e:
print e.reason

if e == '':
print "good to go"

footnote: here's a better way to test if an exception was raised or not:

try:
...
except HTTPError, e:
print e.code
except URLError, e:
print e.reason
else:
print "good to go"

</F>

--
http://mail.python.org/mailman/listinfo/python-list

Thanks! can't believe I didn't think of that.

--
View this message in context: http://www.nabble.com/Testing-for-co...p18493785.html
Sent from the Python - python-list mailing list archive at Nabble.com.

Jul 16 '08 #1
0 828

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Karuna | last post by:
Hi, I have developed a website in my local machine using PHP, MySql and apache. It's not uploaded on the net. The pesrson for whom I have developed this wants to test it before actually putting it...
3
by: Maellic | last post by:
Hi, The website I am working on is built with ASP.NET and connects to a SQL Server 2000 database. The web server and database are on the same machine. I have recently tried to modify the timeout...
0
by: Gustavo Barbosa | last post by:
I´m having this problem: I'm stress testing a ASP.NET web application using ACT and comparing results with a previous version of the website (developed in ColdFusion 4.5). When using 300...
8
by: hufaunder | last post by:
I have a website that consumes a webservice. Both of them are in the Default Website folder. I can execute the service without any problem when I go to the test page http://localhost/Service.asmx....
5
by: OJ | last post by:
Hi, I am at a loss here, I have a c# asp.net website which connects to a remote SQL Server 2000 db via a connection string. If I set the website up in the filesystem and use the inbuilt cassini...
2
by: samadams_2006 | last post by:
Hello, I have a problem that I'm hoping someone will be able to help me resolve. 1) I have a C# Web Site in which I connect to the database: "Install Microsoft SQL Server 2005 Express...
3
by: Alexnb | last post by:
Okay, I already made this post, but it kinda got lost. So anyway I need to figure out how to test if the user is able to connect to a specific website. Last time I got pointed to the urllib2 page,...
0
by: Alexnb | last post by:
Timothy Grant wrote: well I can tel you it didn't work for me. In fact I didn't see the code you posted on there, I ended up figuring it out on my own with a little help from the missing manual...
21
by: =?ISO-8859-1?Q?Fad=A5?= | last post by:
Hello guys, I want to do kinda of an A/B split testing on a website I run. I just created a new version but I need to keep both version running and see which one will perform better. First, I'm...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.