Skip to content

Commit e7f799f

Browse files
committed
Use requests instead of urllib3
1 parent 9398bb0 commit e7f799f

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

seleniumbase/console_scripts/sb_install.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616
import os
1717
import platform
1818
import requests
19-
import urllib3 # Some systems don't have requests.packages.urllib3
2019
import shutil
2120
import sys
2221
import tarfile
2322
import zipfile
2423
from seleniumbase import drivers # webdriver storage folder for SeleniumBase
25-
urllib3.disable_warnings()
2624
DRIVER_DIR = os.path.dirname(os.path.realpath(drivers.__file__))
2725

2826

@@ -186,13 +184,11 @@ def main():
186184
file_path = downloads_folder + '/' + file_name
187185
if not os.path.exists(downloads_folder):
188186
os.mkdir(downloads_folder)
189-
local_file = open(file_path, 'wb')
190-
http = urllib3.PoolManager()
191-
remote_file = http.request('GET', download_url, preload_content=False)
187+
192188
print('\nDownloading %s from:\n%s ...' % (file_name, download_url))
193-
local_file.write(remote_file.read())
194-
local_file.close()
195-
remote_file.close()
189+
remote_file = requests.get(download_url)
190+
with open(file_path, 'wb') as file:
191+
file.write(remote_file.content)
196192
print('Download Complete!\n')
197193

198194
if file_name.endswith(".zip"):

0 commit comments

Comments
 (0)