Hello
I want to make a GUI tool in python Tkinter that can check if the site is up or down, I did a quick search on google and i came up with the following code

import httplib
conn = httplib.HTTPConnection("www.google.com")
conn.request("HEAD", "/")
r1 = conn.getresponse()
print r1.status, r1.reason

I'm happy with it, But when i test it on a site that i know it's down, I don't get any responds at all, It stays there waiting and waiting for the site to be up before it returns to me with 200 OK, But when test it on a site that i know it up and running, I get this (200 OK)

1) How can i make it check the site for like 7 Seconds, If no responds then make it says something like "Down!"

2) Make it keep checking the site every 7 seconds

3) Have it as a GUI with a textbox where to put the URL + a Label for the status + a Button to press to start checking

that will be really helpful from you guys thanks in advance

Possible solution...

import urllib
print urllib.urlopen("http://www.google.com").getcode()

you could always set a variable to equal to that result instead of directly printing it. And using some logic, print messages for each code response.