473,666 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Testing for connection to a website


Timothy Grant wrote:
>
On Tue, Jul 15, 2008 at 3:48 PM, Alexnb <al********@gma il.comwrote:
>>
Alexnb wrote:
>
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, but if I do
urlopen() and and am not connected, the program stops. So I don't know
if
that was what you guys wanted me to do, but I don't think so, you guys
are
smarter than that. So, how can I test for connection to a website.

Just for anyone looking this up later here is code that works :)

from urllib2 import *
import urllib2
e = ''

req = urllib2.Request ('http://www.dictionary. com')
try:
response = urlopen(req)

except HTTPError, e:
print e.code
except URLError, e:
print e.reason

if e == '':
print "good to go"
--
View this message in context:
http://www.nabble.com/Testing-for-co...p18476597.html
Sent from the Python - python-list mailing list archive at Nabble.com.

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

I'm glad to see you found the old post and implemented the code suggested
there.

--
Stand Fast,
tjg. [Timothy Grant]

--
http://mail.python.org/mailman/listinfo/python-list
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 for urllib2. Also, being rude is kinda stupid
because you don't have to help in the first place...
--
View this message in context: http://www.nabble.com/Testing-for-co...p18478103.html
Sent from the Python - python-list mailing list archive at Nabble.com.

Jul 16 '08 #1
0 1239

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

Similar topics

7
1633
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 online on their website. How do I let her test it? Is there a way? regards Karuna
3
3091
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 of the website from 20 mn to 60 mn. I changed the timeout setting in IIS. Now the website itself doesn't time out, however after 20 mn, when I try to access a page that needs to connect to the database, I get the following error message
0
1025
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 simultaneous users (about 25-30 rps), everything works fine, although Cold Fusion seems to be a little faster than ASP.NET. When using 2000 simultaneous users (about 50-60 rps), Cold Fusion works really fine but the application in ASP.NET starts to have...
8
30802
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. When I try to consume that webservice from the website I get the error shown bellow. In my web.config I have: <authentication mode="Windows"/> <identity impersonate="true" userName="auser" password="apwd"/> IIS is configured as "Integrated...
2
4953
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 Edition" via the link on: http://msdn2.microsoft.com/en-us/express/bb410792.aspx
3
2074
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, but if I do urlopen() and and am not connected, the program stops. So I don't know if that was what you guys wanted me to do, but I don't think so, you guys are smarter than that. So, how can I test for connection to a website. -- View this...
0
202
by: Alexnb | last post by:
Alexnb wrote: Just for anyone looking this up later here is code that works :) from urllib2 import * import urllib2 e = '' req = urllib2.Request('http://www.dictionary.com') try:
21
2504
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 not sure if I'm in the right group. How can I randomly let a user enter from the index.php page and keep the same URL. So the splitting is being done in the backend, I don't want the users to see for example in the url /new/index.php and /...
0
8454
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8362
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8644
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6200
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5671
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.