diff --git a/doorUpdater.py b/doorUpdater.py index 8ce22df..213a030 100755 --- a/doorUpdater.py +++ b/doorUpdater.py @@ -4,6 +4,8 @@ import requests import csv from io import StringIO import urllib3 +from hashlib import md5 +import os from passwords import * @@ -69,6 +71,15 @@ def getMembershipworksData(): print(r.text) sys.exit(1) + newHash = md5(bytes(r.text, 'utf8')).hexdigest() + if os.path.exists('/tmp/doorUpdaterLastHash'): + with open('/tmp/doorUpdaterLastHash', 'r') as f: + if newHash == f.read(): + print("hashes are the same, not updating") + sys.exit(0) + with open('/tmp/doorUpdaterLastHash', 'w') as f: + f.write(newHash) + return r.text def makeMember(member, doorAuth):