forked from CMS/memberPlumbing
Add hash checking to getMembershipworksData
to minimize unnecessary updates
This commit is contained in:
parent
c24ba626a7
commit
a22de02d3e
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user