Write lastrun file even if modifications were made
This commit is contained in:
parent
dcc774b92f
commit
6a6c8f88a6
11
montrouge.py
11
montrouge.py
@ -46,16 +46,15 @@ for (k, url) in URLS.items():
|
|||||||
|
|
||||||
dump = json.dumps(data, sort_keys=True,
|
dump = json.dumps(data, sort_keys=True,
|
||||||
indent=4, separators=(',', ': '))
|
indent=4, separators=(',', ': '))
|
||||||
try:
|
|
||||||
with open('lastrun.json', 'r') as fh:
|
with open('lastrun.json', 'r') as fh:
|
||||||
lastrun = fh.read()
|
lastrun = fh.read()
|
||||||
|
|
||||||
|
with open('lastrun.json', 'w') as fh:
|
||||||
|
fh.write(dump)
|
||||||
|
|
||||||
# If something changed, print the fetched data and exit 1 to ensure chronic
|
# If something changed, print the fetched data and exit 1 to ensure chronic
|
||||||
# sends an email.
|
# sends an email.
|
||||||
if lastrun != dump:
|
if lastrun != dump:
|
||||||
print(dump)
|
print(dump)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
except IOError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
with open('lastrun.json', 'w') as fh:
|
|
||||||
fh.write(dump)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user