Skip to content
Snippets Groups Projects
Commit 1f29eb00 authored by Mike Hommey's avatar Mike Hommey
Browse files

Bug 1924022 - Use urlopen's context parameter instead of cafile. a=RyanVM

The latter was removed in python 3.13.

Original Revision: https://phabricator.services.mozilla.com/D225318

Differential Revision: https://phabricator.services.mozilla.com/D225606
parent 95c1c5c8
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
import hashlib
import os
import ssl
from pathlib import Path
from urllib.request import urlopen
......@@ -34,7 +35,8 @@ def http_download_and_save(url, dest: Path, hexhash, digest="sha256"):
that will be used to validate the downloaded file using the given
digest algorithm. The value of digest can be any value accepted by
hashlib.new. The default digest used is 'sha256'."""
f = urlopen(url, cafile=certifi.where())
ssl_context = ssl.create_default_context(cafile=certifi.where())
f = urlopen(url, context=ssl_context)
h = hashlib.new(digest)
with open(dest, "wb") as out:
while True:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment