@@ -0,0 +1,2267 @@
+from differ import Diff%0Afrom email_server import Emailer%0Afrom datetime import date,timedelta%0Afrom glob import glob%0Aimport os%0Aimport json%0A%0Aclass Alert:%0A    def __init__(self):%0A        self.sites = self.parse_sites()%0A        self.emailer = Emailer()%0A    def parse_sites(self):%0A        websites = json.load(open(%22websites.json%22,%22r%22))%0A        sites = %5B%5D%0A        for website in websites:%0A            sites.append(website.split(%22.%22)%5B1%5D)%0A        return sites%0A%0A    def alert(self):%0A        for site in self.sites:%0A            self.send_alert(site)%0A        %0A    def send_alert(self,site):%0A        record_sets = glob(%22../storage/%22+site+%22*%22)%0A        today = str(date.today()).replace(%22-%22,%22%22)%0A        yesterday = str(date.today() - timedelta(days=1)).replace(%22-%22,%22%22)%0A        todays = %5B%5D%0A        yesterdays = %5B%5D%0A        diff = Diff()%0A        for record_set in record_sets:%0A            if today in record_set:%0A                todays.append(record_set)%0A            if yesterday in record_set:%0A                yesterdays.append(record_set)%0A%0A        today_hashes = %5B%5D%0A        for today in todays:%0A            os.chdir(today)%0A            with open(%22sha_hashes.txt%22,%22r%22) as f:%0A                today_hashes.append(f.read().split(%22%5Cn%22))%0A            os.chdir(%22../%22)%0A%0A        yesterday_hashes = %5B%5D%0A        for yesterday in yesterdays:%0A            os.chdir(yesterday)%0A            with open(%22sha_hashes.txt%22,%22r%22) as f:%0A                yesterday_hashes.append(f.read().split(%22%5Cn%22))%0A            os.chdir(%22../%22)%0A%0A        #any variable with _t is today%0A        #any variable with _y is yesterday%0A        for hash_set_t in today_hashes:%0A            for ind_t,hashing_t in enumerate(hash_set_t):%0A                name_t = hashing_t.split(%22000%22)%5B1%5D.split(%22:%22)%5B0%5D%0A                hash_val_t = hashing_t.split(%22:%22)%5B1%5D%0A                for hash_set_y in yesterday_hashes:%0A                    for ind_y,hashing_y in enumerate(hash_set_y):%0A                        hash_val_y = hashing_y.split(%22:%22)%5B1%5D%0A                        if name_t in hashing_y:%0A                            self.emailer.add_website(site)%0A                            self.emailer.add_message(%22the website was updated%22)%0A                            self.emailer.send()%0A%0Aif __name__ == '__main__':%0A    alerter = Alert()%0A    alerter.alert()%0A

Create alerts.py