abort if digest could not be retreived
This commit is contained in:
parent
ab3949db50
commit
f1d44f48c7
1 changed files with 3 additions and 1 deletions
|
@ -146,6 +146,8 @@ def download_wiki(session: requests.Session, title: str, src: str, dst: str):
|
||||||
if method == "SHA-256":
|
if method == "SHA-256":
|
||||||
digest_value = base64.b64decode(data)
|
digest_value = base64.b64decode(data)
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
raise SystemExit(f"Could not get SHA-256 digest for {title}. Aborting.")
|
||||||
|
|
||||||
sha256 = hashlib.sha256()
|
sha256 = hashlib.sha256()
|
||||||
with session.get(url=src, stream=True) as response:
|
with session.get(url=src, stream=True) as response:
|
||||||
|
@ -194,7 +196,7 @@ def main():
|
||||||
filelist = retreive_filelist(session=session, url=KIWIX_BASE_URL)
|
filelist = retreive_filelist(session=session, url=KIWIX_BASE_URL)
|
||||||
save_cached_filelist(cache_file=args.cache_file, filelist=filelist)
|
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 = get_download_files(wikis=args.wiki, filelist=filelist)
|
||||||
|
|
||||||
# Download files
|
# Download files
|
||||||
|
|
Loading…
Reference in a new issue