Created a test web page for my web site

To make it easy to check whether my website is functioning, I built a python webpage to download each sub-site, and check it contains some appropriate text, and display the result.

The test page is here:

web site test page

The source code is something like:

def checksite(sitename, url, checktext):
   serverrequesthandle = urllib.urlopen(url, None )
   serverrequestarray = serverrequesthandle.readlines()
   serverrequeststring = (''.join( serverrequestarray )).decode('utf-8')
   result = sitename + u': '
   if serverrequeststring.find(checktext) > -1:
      result = result + '<font color="green">OK</font>'
   else:
      result = result + '<font color="red">FAIL</font>'
   return result

   result = u""

   try:
      result = result + checksite(u'techblog', "http://hughperkins.com/techblog", u'Hugh Perkins') + u'<br />'
      result = result + checksite(u'writerblog', "http://manageddreams.com/writerblog", u'Hugh Perkins') + u'<br />'
      # etc ...

Hmmm, idea: maybe I could wrap this up in a website itself, and let people register their own sites in it? I guess this probably exists somewhere, but maybe for a ridiculous price, so there could be an opportunity to make something similar, but ad-supported?

Leave a Reply