Merge pull request #329 from nlewo/fix-insecure

Fix insecure ssl in fetch_from_legacy
This commit is contained in:
adisbladis 2021-07-01 10:20:45 -05:00 committed by GitHub
commit fe0227e2ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,9 +44,13 @@ package_filename = sys.argv[3]
print("Reading index %s" % index_url)
context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE
response = urllib.request.urlopen(
index_url,
context=ssl.CERT_NONE)
context=context)
index = response.read()
parser = Pep503()
@ -66,7 +70,7 @@ print("Downloading %s" % package_url)
response = urllib.request.urlopen(
package_url,
context=ssl.CERT_NONE)
context=context)
with response as r:
shutil.copyfileobj(r, package_file)