Testing for Internet Connection

Alexnb alexnbryan at gmail.com
Tue Jul 15 19:49:32 CEST 2008




Alex Marandon-3 wrote:
> 
> Alexnb wrote:
>> I am wondering, is there a simple way to test for Internet connection? If
>> not, what is the hard way :p
> 
> Trying to fetch the homepage from a few major websites (Yahoo, Google, 
> etc.)? If all of them are failing, it's very likely that the connection 
> is down. You can use urllib2 [1] to accomplish that.
> 
> [1] <http://docs.python.org/lib/module-urllib2.html>
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
> 

What exactly do you think will work? I am not sure what you think I should
do? If I use urlopen("http://www.google.com") and I am not connected, I am
not going to get an exception, the program will fail.

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




More information about the Python-list mailing list