abort if digest could not be retreived

This commit is contained in:
Jan-Marten Brüggemann 2024-09-14 01:37:07 +02:00
parent ab3949db50
commit f1d44f48c7

View file

@ -146,6 +146,8 @@ def download_wiki(session: requests.Session, title: str, src: str, dst: str):
if method == "SHA-256":
digest_value = base64.b64decode(data)
break
else:
raise SystemExit(f"Could not get SHA-256 digest for {title}. Aborting.")
sha256 = hashlib.sha256()
with session.get(url=src, stream=True) as response:
@ -194,7 +196,7 @@ def main():
filelist = retreive_filelist(session=session, url=KIWIX_BASE_URL)
save_cached_filelist(cache_file=args.cache_file, filelist=filelist)
# Get downlaod files list
# Get download files list
download_files = get_download_files(wikis=args.wiki, filelist=filelist)
# Download files