Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sopel/modules/safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ def setup(bot: Sopel):
except Exception as err:
# for lack of a more specific error type...
# Python on Windows throws an exception if the file is in use
LOGGER.info('Could not delete %s: %s', old_file, str(err))
LOGGER.warning('Could not delete %s: %s', old_file, str(err))

LOGGER.info('Ensuring unsafe domain list is up-to-date (safety plugin setup)')
update_local_cache(bot, init=True)


Expand All @@ -141,12 +142,12 @@ def download_domain_list(bot: Sopel, path: str) -> bool:
url = bot.settings.safety.domain_blocklist_url
if url is None or not url.startswith("http"):
url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
LOGGER.info("Downloading unsafe domain list from %s", url)
LOGGER.debug("Downloading unsafe domain list from %s", url)
old_etag = bot.db.get_plugin_value("safety", "unsafe_domain_list_etag")
if old_etag:
r = requests.head(url)
if r.headers["ETag"] == old_etag and os.path.isfile(path):
LOGGER.info("Unsafe domain list unchanged, skipping")
LOGGER.debug("Unsafe domain list unchanged, skipping")
return False

r = requests.get(url, stream=True)
Expand Down Expand Up @@ -486,6 +487,6 @@ def _clean_cache(bot: Sopel):

LOGGER.debug('Safety cache cleanup finished.')
else:
LOGGER.info(
LOGGER.debug(
'Skipping safety cache cleanup: Cache is locked, '
'cleanup already running.')