Archive WSJ articles first, catch KeyboardInterrupt

This commit is contained in:
2019-10-15 21:03:47 +00:00
parent 9c4766a928
commit 810e8c5ead
5 changed files with 26 additions and 11 deletions

View File

@@ -152,6 +152,8 @@ try:
news_index += 1
if news_index == CACHE_LENGTH: news_index = 0
except KeyboardInterrupt:
logging.info('Exiting...')
finally:
with shelve.open(DATA_FILE) as db:
logging.info('Writing caches to disk...')