handle no redirects in config

This commit is contained in:
Tomáš Mládek 2019-11-07 16:29:29 +01:00
parent 409ffc4b7e
commit 39cbfb851a

View file

@ -11,7 +11,7 @@ import subprocess
import sys
import tempfile
import unicodedata
from configparser import ConfigParser
from configparser import ConfigParser, NoSectionError
from datetime import datetime, timedelta
from glob import glob
from operator import itemgetter
@ -796,10 +796,15 @@ if __name__ == '__main__':
logging.warning("Didn't find `initial.txt`, continuing without markov blabbering!")
markov = None
try:
redirects = config.items('redirects')
except NoSectionError:
redirects = {}
delojza = DelojzaBot(config.get('delojza', 'tg_api_key'),
config.get('delojza', 'OUT_DIR', fallback=os.path.join(_DIR_, "out")),
tmp_dir=config.get('delojza', 'tmp_dir', fallback=tempfile.gettempdir()),
redirects=config.items('redirects'),
redirects=redirects,
protected_password=config.get('delojza', 'protected_password', fallback=None),
acoustid_key=config.get('delojza', 'acoustid_api_key', fallback=None),
tumblr_name=config.get('tumblr', 'blog_name', fallback=None),