Skip to content

Commit

Permalink
Use explicit SSLContext for urlopen
Browse files Browse the repository at this point in the history
  • Loading branch information
danielkaiser committed Dec 1, 2022
1 parent fbf17e3 commit 91adfbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion chromedriver_binary/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import sys
import os
import ssl
import subprocess
import re
import platform
Expand Down Expand Up @@ -91,7 +92,7 @@ def get_latest_release_for_version(version=None):
if version:
release_url += '_{}'.format(version)
try:
response = urlopen(release_url)
response = urlopen(release_url, context=ssl.SSLContext(protocol=ssl.PROTOCOL_TLS))
if response.getcode() != 200:
raise URLError('Not Found')
return response.read().decode('utf-8').strip()
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from chromedriver_binary.utils import get_chromedriver_filename, get_chromedriver_url, find_binary_in_path, check_version

import os
import ssl
import zipfile

try:
Expand Down Expand Up @@ -41,7 +42,7 @@ def run(self):
os.mkdir(chromedriver_dir)
url = get_chromedriver_url(version=chromedriver_version)
try:
response = urlopen(url)
response = urlopen(url, context=ssl.SSLContext(protocol=ssl.PROTOCOL_TLS))
if response.getcode() != 200:
raise URLError('Not Found')
except URLError:
Expand All @@ -58,7 +59,7 @@ def run(self):

setup(
name="chromedriver-binary",
version="108.0.5359.71.0",
version="108.0.5359.71.1",
author="Daniel Kaiser",
author_email="[email protected]",
description="Installer for chromedriver.",
Expand Down

0 comments on commit 91adfbc

Please sign in to comment.