How do I get the counting loop to come back around? It makes one pass fine. How do I get it to come back up and go through again? 

Thanks

-------------------------------------------------------
import urllib, smtplib

urls = ("http://website0.net/imalive.asp",
          "http://website1.net/imalive.asp",
          "http://website2.net/imalive.asp",
          "http://website3.net/imalive.asp",
          "http://website4.net/imalive.asp",)
         
count = 0
for i in urls: 
    web = urls[count]
   
    for site in urllib.urlopen(web):

        good = "400 Bad Request"
        bad = "Invalid Hostname"
        smtpserver = 'mail.authentium.com'
        RECIPIENTS = ['[EMAIL PROTECTED]']
        SENDER = '[EMAIL PROTECTED]'
        mssg = site

        if good in site:
            print "OK"
            text_file = open("test.log", "a")
            text_file.writelines('sometext : ')
            text_file.writelines(site)
            text_file.writelines("\n")
            text_file.close()

        elif bad in site:
              print "NOT OK"
              text_file = open("test.log", "a")
              text_file.writelines('metro-ams : ')
              text_file.writelines(site)
              text_file.writelines("\n")
              text_file.close()
              session = smtplib.SMTP(smtpserver)
              smtpresult = session.sendmail(SENDER, RECIPIENTS, mssg)
              if smtpresult:
                        errstr = ""
                        for recip in smtpresult.keys():
                            errstr = """Could not delivery mail to: %s

                    Server said: %s
                    %s

                    %s""" % (recip, smtpresult[recip][0], smtpresult[recip][1], errstr)
                        raise smtplib.SMTPException, errstr

   
        else:
              text_file = open("test.log", "a")
              text_file.writelines('Another type of error occurred : ')
              text_file.writelines(site)
              text_file.writelines("\n")
              text_file.close()
print web
count +=1
print count
-----------------------------------------------------------------------------------

Thanks


--
Arthur DiSegna
Network Operations Center
Authentium, Inc.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to